Question

I would like to deny all users to this page but it gives me this error:

<location> path attribute must be a relative virtual path.  It cannot contain any of '?' ':' '\' '*' '"' '<' '>' or '|'

Here is my web.config file code:

</configuration>
<location path="http://10.19.13.68/Dashboardviewer/Imv.aspx">
    <system.web>
      <authorization>
        <deny users="*"/>
      </authorization>
    </system.web>   
  </location>
</configuration> 
Was it helpful?

Solution

use below code, it may help for you (http://weblogs.asp.net/gurusarkar/archive/2008/09/29/setting-authorization-rules-for-a-particular-page-or-folder-in-web-config.aspx):

<configuration>    <system.web>
     <authentication mode="Forms"/>
        <authorization> <deny users="?"/>  //this will restrict anonymous user access
        </authorization>   </system.web>
     <location path="register.aspx"> **//path here is path to your register.aspx page e.g. it could be ~/publicpages/register.aspx**
    <system.web>
      <authorization>
            <allow users="*"/> // this will allow access to everyone to register.aspx
      </authorization>
    </system.web>    </location> </configuration>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top