为什么表单action属性空生产服务器上? [英] Why is the form action attribute empty on production server?

查看:142
本文介绍了为什么表单action属性空生产服务器上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

部署ASP.NET WebForms的应用程序到生产服务器的一些Ajax调用已经停止为我工作后。经过一番调试我发现,下面的语句(内部客户的方法WebForm_DoCallback)是造成问题:

After deploying a ASP.NET WebForms application to a production server some of the ajax calls has stopped working for me. After some debugging I found out that the following statement (in the internal client-method WebForm_DoCallback) was causing the problem:

xmlRequest.open("POST", action, true);

这个问题似乎是,该操作变量是空的,所以检查所提供的HTML后,我发现表单标签在生产服务器上呈现的样子:

The problem seemed to be that the action-variable was empty so after checking the rendered html I found out that the form-tag rendered on the production server looks like:

<form method="post" action="" id="Form1">

不过,在我的开发机器,我得到如下:

However, on my developer machine I get the following:

<form method="post" action="default.aspx" id="Form1">

那么,为什么会行动attibute呈现在我的dev.machine而不是在生产服务器上?这似乎是只为一个特定的Web表单的情况下,当我看到其他页面上的操作属性正确渲染。

So, why would the action-attibute render on my dev.machine but not on the production server? This seems to be the case only for one specific web form, when I look on other pages the action-attribute renders correctly.

任何建议或想法会很有帮助!

Any suggestions or ideas would be helpful!

推荐答案

我也有这个问题。我安装点生产的Windows 2003 R2服务器上的.NET框架4,得到了IIS6上运行的应用程序,设置它的框架4.0,把它放在它自己的应用程序池,然后我得到的。我也注意到,它不是装载了JScript中我的一个登录页面,所以也许这是一个安全问题?

I too have this issue. I installed dot net framework 4 on the production Windows 2003 R2 server, got the application running on IIS6, set it's framework to 4.0, put it in it's own app pool, then I got that. I've also noticed that it isn't loading up jscript one my login page, so perhaps it's a security issue?

尽管关注的是,当我去到默认页面,通过选择网站的网址 的http:// mysite的 该动作没有投入 但是,当我去那里直接使用实际的页面(即使它呈现的内容完全相同),它把行动正确。

Interesting though that when I go to the default page by selecting the site url http://mysite the action is not put in But when I go there directly using an actual page (even though it's rendering exactly the same content) it puts the action in correctly.

总之,我的解决方法是设置使窗体RUNAT =服务器(它可能已经被),然后在服务器上设置action属性为当前Page.Path(可能是一个不同的属性,我忘了)和这解决了这个特殊的问题。

Anyhow, my workaround was to set make the form runat=server (it may have been already) and then set the Action attribute on the server to the current Page.Path (could have been a different property, I forget) and that solved that particular problem.

不过,我没有遇到一个重大更改文件的点网4框架,谈到了消隐的action属性: http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes 看到标题为事件处理程序可能不是没有提出一个默认文档在IIS 7或IIS 7.5集成模式下的

However, I did come across a breaking changes document for the dot net 4 framework that talks about the blanking out of the action attribute: http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes see the section titled "Event Handlers Might Not Be Not Raised in a Default Document in IIS 7 or IIS 7.5 Integrated Mode"

这篇关于为什么表单action属性空生产服务器上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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