Streamline your flow

Asp Net Core Mvc Http Post Method Not Return To View Stack Overflow

Asp Net Core Mvc Http Post Method Not Return To View Stack Overflow
Asp Net Core Mvc Http Post Method Not Return To View Stack Overflow

Asp Net Core Mvc Http Post Method Not Return To View Stack Overflow In .cshtml side, i change dropdownlist selection item and controller post method triggering. i did some operations on the data and i want to return new data to view and display it. It's called "modelstatetotempdata" and it basically, in case of validation error, serialize your modelstate into the tempdata during your post action, and automatically deserialize it back in the next get method. in order for your code to work, you're going to need a view called submitstudent.aspx inside the views\student\ or views\shared\ folders.

C Post Method Is Not Working In Asp Net Core Stack Overflow
C Post Method Is Not Working In Asp Net Core Stack Overflow

C Post Method Is Not Working In Asp Net Core Stack Overflow Long and short, you should be following the prg (post redirect get) pattern. on post, you return the view only on error. on success, you redirect. if you want the user to see the same form again on success, then simply redirect to the same page. the act of redirecting causes a new get request, clearing out modelstate from the previous post. I viewed this page: how to call post method in core mvc directly from razor view? for a solution, but it didn't workout as thought. i am using this lorem lpsum generator: github edcharbeneau prototyping. Change the the from declaration in your view to explicitly defined the action name and controller name of your httppost login action. replace "mycontrol" with the actually name of your controller. You need to declare a model class, which should have a boo or string property depending on your requirement. then you can declare the object of that class (let's say obj) in your action method test and then return like this return view(obj);.

C Asp Net Core Mvc Http Post Method Gets Null As An Argument From
C Asp Net Core Mvc Http Post Method Gets Null As An Argument From

C Asp Net Core Mvc Http Post Method Gets Null As An Argument From Change the the from declaration in your view to explicitly defined the action name and controller name of your httppost login action. replace "mycontrol" with the actually name of your controller. You need to declare a model class, which should have a boo or string property depending on your requirement. then you can declare the object of that class (let's say obj) in your action method test and then return like this return view(obj);. I have created a two views in same controller. the issue is, i want to load second view after httppost is done. index view. return view(); httppost. return view("nextview"); next view. return view(); after httppost, i have added return to nextview. whereas it always return back to index view. I have a form that should pass data through post request, but get request is being used without passing the data and do model binding of asp core, so buz of that the method registrationp is never reach if the attribute [httppost] is in place ; ( . i tried…. For more information, see prevent cross site request forgery (xsrf csrf) attacks in asp core. the httpget edit method takes the movie id parameter, looks up the movie using the entity framework findasync method, and returns the selected movie to the edit view. By using the asp core api, if you want to return json result, you could install the microsoft.aspnetcore.mvc.newtonsoftjson package, then call the addnewtonsoftjson () method in the configureservices method:.

Comments are closed.