c# - authorization in MVC project -
i have login page in mvc project , 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 access in register page?
depending on version of mvc you're using mutual practice see in mvc3/4 instead of restricting access specific actions, restrict access actions, adding authorize()
global filter , grant access few select actions using allowanonymous()
attribute deed white-list of actions not need protected. (like login, register, etc).
global.asax
protected void application_start() { filters.add(new authorizeattribute()); }
accountscontroller.cs
[allowanonymous] public actionresult login() { //perform login... }
then you're web.config has this
<authorization> <allow users="*" /> </authorization>
c# asp.net-mvc model-view-controller
No comments:
Post a Comment