使用ASP.NET中的response.redirect重新加载页面上的Javascript错误 [英] Javascript error on page reload using response.redirect in asp.net
本文介绍了使用ASP.NET中的response.redirect重新加载页面上的Javascript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
页面上有一个按钮,用于将用户重定向到同一页面.
I have a button on my page which I use to redirect the user to the same page.
protected void Undo123_Click(object sender, EventArgs e)
{
Page.Response.Redirect(Page.Request.Url.ToString(), true);
}
我收到此错误:
I get this error:
Microsoft JScript runtime error:
Sys.WebForms.PageRequestManagetServerErrorException: An unknown error occurred while processing the request on the server.The status code returned from the server was 500
前一天,我在每次单击按钮时都收到此错误,但是当我关闭解决方案并再次打开它时,它就消失了.关闭解决方案现在不起作用.
我是否可以知道此错误的原因以及如何解决此问题.
谢谢!
I got this error on every button click the day before, but when I closed the solution and opened it again, it was gone. Closing the solution does not work now.
May I know the reason behind this error and how do I resolve that in my case.
Thank you !
推荐答案
尝试一下:
http://forums.asp.net/t/1178621.aspx/1 [ ^ ]
try this:
http://forums.asp.net/t/1178621.aspx/1[^]
为什么您想重新加载页面吗?
将UpdatePanel与属性
Why do you want to reload your page??
Use UpdatePanel with property
UpdateMode="Conditional"
一起使用
调用UpdatePanel的方法"Update()"以重新加载Updatepanel的控件
call UpdatePanel''s Method "Update()" to reload the controls of Updatepanel
表单上是否有任何JavaScript代码.我认为,在重新加载它时,它会在抛出异常的地方找到一些值(或根据您的代码得出的值).
您在Undo123_Click中的代码是正确的.
Do you have any javascript code on the form. I think when its reloading its finding some value (...or something as per your code ) where its throwing exceptiion.
Your code in Undo123_Click is correct.
这篇关于使用ASP.NET中的response.redirect重新加载页面上的Javascript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文