Form authorization problem

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.
 
M

Martin Marinov

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
 
N

nick

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
 
N

nick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top