Quantcast
Viewing all articles
Browse latest Browse all 3527

problem publishing asp.net mvc site : model didn't receive on form submit

I have written an asp.net mvc site that works fine on local. But after publishing it, i have some problems with models sent from forms. i think it determines my model state always not valid. i don't receive any data!

[HttpGet]publicActionResultLogIn(){returnView();}[HttpPost]publicActionResultLogIn(Models.LoginViewModel data){if((!ModelState.IsValid)&&(data.UserName==null||data.Pass==null||data.UserName==string.Empty||data.Pass==string.Empty)){returnLogIn();}TAPortalEntities db =newTAPortalEntities();UserAccount probableUser = db.UserAccounts.FirstOrDefault(p => p.UserName== data.UserName&& p.Pass== data.Pass);if(probableUser ==null){ModelState.AddModelError(string.Empty,"نام کابری یا رمز عبور اشتباه وارد شده است!");returnLogIn();}Session["LogedIn"]=true;Session["UserName"]= probableUser.UserName;Session["Course"]= probableUser.Course.Name;Session["TeacherName"]= probableUser.Course.TeacherName;Session["RealName"]= probableUser.RealName;returnRedirectToAction("Index","Home");}



Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>