How to display error in different controller after post in ASP.NET MVC3 -
first thing, sorry english.
i have 2 forms in index.
login form post localhost/account/logon
register form post localhost/account/signup
how can display error in localhost/ after user post 1 of form ?
currently error display in localhost/account/logon or localhost/account/signup
these codes:
#index action in homecontroller public function index() actionresult return partialview("_default") end function #_default layout <html> <head></head> <body> @code html.renderaction("signup", "account") end code @code html.renderaction("logon", "account") end code </body> </html> #signup action in accountcontroller public function signup() actionresult return partialview() end function <httppost()> _ public function signup(user userview) actionresult if modelstate.isvalid 'some process return redirecttoaction("welcome", "home") else modelstate.addmodelerror("", "email taken") end if return partialview(user) end function
basically logon action in accountcontroller same signup action
i think i'm stuck return partialview(user)
i need return index action in homecontroller , maintain modelstate
any hint this?
i think usage of prg (post-redirect-get) pattern practice, , can in managing problem. modelstate imported , exported filters.
look @ point no 13 here http://weblogs.asp.net/rashid/archive/2009/04/01/asp-net-mvc-best-practices-part-1.aspx#prg
i think it's relevant.
Comments
Post a Comment