c# - Redirecting to a page using mvc -
i have first method below contained in dll. decided extend can have control on page redirect to. @ moment when pass returnurl nothing happens. page returns view entered values.
? want able redirect page resides in path /views/rental/index how can achieve that?
[httppost] public virtual actionresult createaccount(createnewaccountinfo createnewaccountinfo, website website, string returnurl) { if (this._accountmanager.usernamealreadyexists(createnewaccountinfo.username)) this.modelstate.addmodelerror("createnewaccountinfo", errormessageprovider.createnewaccountinfo_username_alreadyexists); if (this.modelstate.isvalid) { this._accountmanager.createnewaccount(createnewaccountinfo); return this.redirecttoreturnurl(returnurl); } else { signin1viewmodel signin1viewmodel = this.createsignin1viewmodel(website, returnurl); this.setupguestcheckout(website, returnurl, signin1viewmodel); return (actionresult) this.view(signin1viewmodel.webpage.viewname, (object) signin1viewmodel); } } public override actionresult createaccount(createnewaccountinfo createnewaccountinfo, website website, string returnurl) { returnurl = "../views/rental/index"; base.createaccount(createnewaccountinfo,website,returnurl); return base.createaccount(createnewaccountinfo, website, returnurl); }
what about:
return redirecttoaction("index", "rental");
Comments
Post a Comment