如何在页面回发后保持URL相同,并在MVC中出错 [英] How to keep url same after page postback with error in MVC

查看:49
本文介绍了如何在页面回发后保持URL相同,并在MVC中出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好开发者,



我正在使用MVC 5页面提交数据的页面。

我有一个网址在我的页面上使用查询字符串。



我的方案是提交数据成功然后重定向到另一个页面

并且当出现错误时保持打开状态与之前填充的数据相同的页面并显示错误。



我已经实现了第一个和第二个场景的一半,但是当我发布数据和错误时

发生 - 我的网址丢失了查询字符串。





例如。我的实际网址是 - > www.example.com/register.htm?id=1&val=abc&ref=xyz



当我发布数据并发生错误时,它变成了 - www.example.com/register .htm



我想在发生错误时保持网址相同,以便用户可以重新加载页面。



请帮帮我们。



提前致谢。

Hello Developers,

I am working on the page in MVC 5 where page is submitting the data.
I have a url with querystring on my page.

My scenario is when submitting data is successful then redirect to another page
and when error occurs then remain on same page with previously filled data and show the error.

I have achieved the first one and also half of second scenario but when i post data and error
occurs - my url losts the querystring.


eg. My actual url is -> www.example.com/register.htm?id=1&val=abc&ref=xyz

when i post data and error occurs it becomes - www.example.com/register.htm

I want to keep the url same when error occurs so user can reload the page.

Please help me guys.

Thanks in advance.

推荐答案

这篇关于如何在页面回发后保持URL相同,并在MVC中出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆