Form authorization problem

  • Thread starter Thread starter nick
  • Start date Start date
N

nick

Hi, How should I write the web.config file to allow some of the aspx files
be executable to all users and others are required users to login? All the
aspx files are in the same folder.
 
you could use something like this :
<authentication mode="Forms">
<forms name="YourName" loginUrl="login.aspx" protection="All" />
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>

<location path="yourpage.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>

This will ask the user for login, but if the user reach yourpage.aspx it
will be allowed to everybody without a login

Regards
Martin
 
Thanks, however, after I modified the code, I got the following error:

Server Error in '/calendar' Application.
----------------------------------------------------------------------------
----

Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section 'location'

Source Error:

Line 71: -->
Line 72: </authorization>
Line 73: <location path="calendar.aspx">
Line 74: <system.web>
Line 75: <authorization>

Source File: c:\inetpub\wwwroot\calendar\web.config Line: 73
 
never mind, the location is at wrong place...

nick said:
Thanks, however, after I modified the code, I got the following error:

Server Error in '/calendar' Application.
-------------------------------------------------------------------------- --
----

Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section 'location'

Source Error:

Line 71: -->
Line 72: </authorization>
Line 73: <location path="calendar.aspx">
Line 74: <system.web>
Line 75: <authorization>

Source File: c:\inetpub\wwwroot\calendar\web.config Line: 73
 
Back
Top