I have login page in MVC project and i created authorization config this.
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" defaultUrl="~/Home/Index"/>
</authentication>
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
How can i access in register page?
Depending on what version of MVC you're using the common practice I see now in MVC3/4 is to instead of restricting access to specific actions, to restrict access to all actions, by adding
Authorize()
as a global filter and then grant access to a few select actions using theAllowAnonymous()
attribute to act as a white-list of actions that do not need to be protected. (Like Login, Register, etc).global.asax
AccountsController.cs
Then you're web.config just has this
By default you should go to
Register()
action method ofAccount
controllerAccording to your web.config: try to add this to web.config before
<system.web>
tag.