I am developing an Asp.Net MVC website using Windows Identity Foundation and STS websit开发者_StackOverflow社区e for authentication. it works fine as whenever a user tries to access a URL, it redirects to STS website if that session is not authenticated.
Now I want to add a page in the application which should be available without authenticating into the site. But I am unable to do that. I tried giving the following in web.config. Still it gets redirected to the STS website. Here i want to allow anonymous access to "Public" controller and all its actions.
<location path="Public">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
It will be great if somebody can guide me with the solution.
Thanks
NOTE: I realize I'm about a year late with this answer, but I wanted to document it for future reference.
The asterisk (*) in the users attribute refers to all authenticated users. To allow anonymous or unauthenticated users, a question mark (?) should be used as shown below.
<location path="Public">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
Take a look at this sample app. We ended up disabling the automatic redirect and controlling that ourselves.
More details on how it works here.
精彩评论