i have basic controller create action both , post. works fine , renders page, however, post redirects me login page , data not save. using forms authentication i'm not using [authorize] attribute yet on of controller actions. works fine locally on machine, when publish server, error starts happening. here code create methods:
[httpget] public actionresult create() { var employee = new employeeviewmodel(); return view(employee); } [httppost] public actionresult create(employeeviewmodel viewmodel) { var datamodel = viewmodel.transformtodatamodel(); allemployees.add(datamodel); viewdata["successmessage"] = string.format("{0} added system", viewmodel.name); return view("success"); }
i using default aspnetsql membership/roleprovider/profileprovider , hosting on godaddy using iis 7.0. here main parts of web.config file:
<authentication mode="forms"> <forms name="formcookie" protection="none" enablecrossappredirects="false" requiressl="false" loginurl="~/account/logon" timeout="2880" defaulturl="~/home/index" path="/" /> </authentication> <authorization> <deny users="?"/> <allow users="*" /> </authorization> <identity impersonate="true"/>
if has come across error before or knows going on, of immense help. thank you!
in asp.net mvc preferred way handle authorization using [authorize]
attribute. <authorization>
section in web.config should removed.
Comments
Post a Comment