asp.net - Issue with RedirectAction -


i have formcontroller index action , simplecontroller corticonindex action.

i redirecting corticonindex index action. problem is, have put breakpoint @ return redirecttoaction() , corticonindex().

so,only first time can see execution f11 second time controller not going corticonindex().

how redirecttoaction() work?

is 1 time execution or can execute multiple time??

formcontroller

[httppost] public actionresult index(formcollection formcollection) {     return redirecttoaction("corticonindex", " simplecontroller"); } 

simplecontroller

public actionresult corticonindex() {     var viewmodel = this.model.getviewmodel(payload);     return view(corticonresponsemodel.viewname, viewmodel); } 

how redirecttoaction() work?

it sends http 302 response browser of web site along location header. browser browser. normally, use location header submit request server. but, entirely out of application's control, there no guarantees.

but in case calling server using http post. if browser reloads page using http get, not hit same action method. if have http action method named index, call 1 instead.

note: fyi - if remove httppost attribute, action method respond both , post. not solution issue, normal have separate action method in each case.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -