Jump to content
Xtreme .Net Talk

Login page in web.config. Can I put exceptions ?


Recommended Posts

Posted

Hello everybody,

 

I'm using a secured access to my website using specific tags in my web.config file such as :

 

<authentication mode="Forms">

<forms

name=".ASPXFIDEXEC"

loginUrl="login.aspx"

protection="All"

timeout="60"

/>

</authentication>

 

The problem is that there is one page that would like users to access without having to Log In. Can I add exceptions to avoid my web.config to redirect me automatically to the login.aspx page ?

 

Thanks in advance!

Scalf.

Do not want others to know what you have done? Better not have done it anyways.

Posted

Read up on the <location> section. I can't recall all the details right now, but you'd create a <location> section with <system.web> and <authorization> subsections for each secure page in your app. you indicate the page by using the "path" attribute in your <location> marker.

 

you can have multiple <location> sections and you'd put them in between the <configuration> markers of your web.config file. in order to process these special pages first I think you have to put them before the default <system.web> that's already in the file.

 

so something like this

<configuration>

<location path="food.aspx">

<system.web>

<authorization>

~~!@@

</authorization>

</system.web>

</location>

<location path="games.aspx">

<system.web>

<authorization>

~~!@@

</authorization>

</system.web>

</location>

<system.web>

<authorization>

</authorization>

</system.web>

</configuration>

 

success

 

(oh great i indented but it won't show...oh well)

  • Administrators
Posted

IIRC within the configuration section of your web.config you can add a location element and set it's path attribute to either a sub folder or an aspx page. Within that you can use most of the standard web.config elements including authorization

i.e. given a page with the catchy name of AnyOneCanAccessThisPage.aspx you should be able to use the following snippet.

 


   
     
       
     
   

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Many thanks

 

It works fine. I added a location section for the page I wanted to exclude from my secured web space and added also a <location> </location> section for the secured part of my web site (no path parameters for this location part).

 

Many thanks to all the friendly guys how helped me solve this problem!!!

;)

 

 

IIRC within the configuration section of your web.config you can add a location element and set it's path attribute to either a sub folder or an aspx page. Within that you can use most of the standard web.config elements including authorization

i.e. given a page with the catchy name of AnyOneCanAccessThisPage.aspx you should be able to use the following snippet.

 

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

Scalf.

Do not want others to know what you have done? Better not have done it anyways.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...