开发者

asp.net Allow single page to be viewed without authorisation

Possibly a stupid question: I have a site, developed by an outside company, which requires logon for all pages.

We'd like to add a single page to the site that DOESN'T require the user to be logged in...so they can click the link on the logon page to view "T&C's" type info.

Is t开发者_C百科his possible?

(ASP.Net 4.0 on IIS)


If you're using the ASP.Net membership providers you can specify this in the web.config file. Where for blocked pages you would expect:

<authorization>
    <allow roles="granted"/>
    <deny users ="*"/>
</authorization>

you can specify this per folder (or per page):

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

to allow everyone access to this specific page.

Note that you can create a specific web.config in a folder in your website, these settings override the general web.config. This allows you to customize these settings per folder level.


Thanks to oɔɯǝɹ for pointing me in the right direction:

Added this after my node

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


Will this only have static content? Is it the asp.net application dealing with authentication?

If so you can just upload a .html file containing simple HTML (and your T&C) which will be served no problem to anyone requesting it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜