0
I have an Asp.net MVC application with Formsauthentication, but the need arose to release a page for the visitor of the site or a page is released for everyone and the rest of the controllers falls on the login screen, it is possible?
0
I have an Asp.net MVC application with Formsauthentication, but the need arose to release a page for the visitor of the site or a page is released for everyone and the rest of the controllers falls on the login screen, it is possible?
0
Yes, it is possible. In your controller, or over your Action, you must have a "[Authorize] attribute". All actions with this attribute mean that they can only be accessed if the user is authenticated, the pages you want to make public, in the corresponding actions, you do not place this attribute. Once the attribute is placed in the controller it means that any action from that controller needs authentication.
You can also configure this via Web.config, but I think the attribute is simpler.
Thank you Jhonathan and Rodrigo!
0
You can release the following controller by placing this code on your Web.config
<location path="ControllerName">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
If you are using Authorize, you can put in the method the implementation of [Allowanonymous] as Annotation of the same to free for non-authenticated users.
Browser other questions tagged c# mvc forms-authentication
You are not signed in. Login or sign up in order to post.
Are you using Authorize to authenticate? If so, try using the Allowanonymous attribute for this. http://stackoverflow.com/questions/9727509/how-to-allow-an-anonymous-user-access-to-some-given-page-in-mvc
– Gabriel Katakura