“WebForm_PostBackOptions” ASP.Net 网站上出现未定义错误

发布于 2024-12-12 01:44:33 字数 180 浏览 0 评论 0原文

我的预编译 ASP.Net 4 网站刚刚在按钮单击事件上出现了 JavaScript 错误,该事件应该回发到另一个页面。

我以前从未见过此错误,并且该网站正在运行。我到底做了什么?我什至不知道要向您展示什么代码???

在VS2010中调试时页面工作正常。

我希望今天启动该网站,因此我们将不胜感激。

My precompiled ASP.Net 4 website has just developed a JavaScript error on a button click event that is supposed to postback to another page.

I have never seen this error before and the site was working. What the heck have I done? I'm not even sure what code to show you???

The page works fine when debugging in VS2010.

I was hoping to launch the site today so any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日久见人心 2024-12-19 01:44:33

我实际上从未找到导致每个带有回发的按钮生成错误的原因。不过我确实发现早期版本工作正常。所以我逐页重建了网站,错误就消失了。酒吧一!

这是在订单页面上并生成相同的错误(空 axd 文件等)。但这次我能够追踪到这部分代码:

 if (ViewState["billID"] == null)
 {
      billID = Convert.ToInt32(ViewState["billID"].ToString());
 }

修改代码以

if (ViewState["billID"] == null)
{
     billID = Convert.ToInt32(ViewState["billID"]);
}

......修复它。

我对使用 ToString() 有点过于热心了!希望这能帮助其他人解决同样的问题。

I never actually found what was causing every button with a postback to generate the error. However I did find that an earlier version was working OK. So I reconsrtructed the site, page by page and the error went. Bar one!

This was on the order page and generated the same error (empty axd files etc). But this time I was able to track it down to this section of code:

 if (ViewState["billID"] == null)
 {
      billID = Convert.ToInt32(ViewState["billID"].ToString());
 }

Amending the code to...

if (ViewState["billID"] == null)
{
     billID = Convert.ToInt32(ViewState["billID"]);
}

...fixed it.

I was being a little over zealous with using ToString()! Hopefully this will help someone else with the same issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文