Joby Kurian
Joby Kurian

Reputation: 3937

How to avoid Form Authentication for 2 pages

I have used Form Authentication in my web project.I don't want Form Authentication for two pages.How can i avoid this ?.

Upvotes: 0

Views: 433

Answers (3)

Imran Rizvi
Imran Rizvi

Reputation: 7438

Write the following location tags replace Logout.aspx and Login.aspx page names with your two pages name.

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

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

Upvotes: 4

Grant Thomas
Grant Thomas

Reputation: 45068

Use the <location> element to 'granulate' the authentication requirements:

<location path="path/to/resource">
  <system.web>
    <authorization>
      <allow users="*"/>
    </authorization>  
  </system.web>
<location>

Other than the MSDN documentation, this is a reasonable post on setting authorization rules, too.

You can also place separate, dedicated web.config files within sub-directories to have self-contained control within that directory - I'm not fond of this though, and much prefer a nicely structured root configuration.

Upvotes: 1

Henk Holterman
Henk Holterman

Reputation: 273681

You can add a section to the config to allow anonymous access to certain pages:

<configuration>

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

</configuration>

Upvotes: 1

Related Questions