ASP.net不填充动作= QUOT;"服务器形式发布的时候 [英] ASP.net doesn't populate action="" of the server form when released

查看:154
本文介绍了ASP.net不填充动作= QUOT;"服务器形式发布的时候的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.net web表单部位,用在母版的服务器的形式,如所有页面需要它。

在调试动作参数是在运行时使用 ID一起填充,但与部署我的服务器上IIS7它不会出现......但仍然有效。它不导致网站的问题,但其使我的W3C HTML5验证失败,因为它需要填充

调试来源:

 <形式方法=邮报行动=的Index.aspxID =aspnetForm>

直播来源:

 <形式方法=邮报行动=ID =aspnetForm>

在母版形式声明:

 <形式=服务器>
..一些div
< /表及GT;

我知道表单标签可是没有定义ID /动作等,因为ASP配置默认的运行时和那很好,但由于某种原因,我的服务器上搅乱。我已经使用行动试图=<%路径等等%GT;,以获取路径名,但它不工作。

我是什么做错了吗?我缺少的东西,或只是不好的做法,在母版使用的一种形式?

感谢。

更新

好吧,解决问题我刚才设置的母版的Page_Load的Form.Action答案中指出,终于获得了W3C绿灯!

注意:我使用Intelligencia重写,但你可以用拉的Request.Url网址

 公共部分类myMasterPage:System.Web.UI.MasterPage
{
    保护无效的Page_Load(对象发件人,EventArgs的发送)
    {
        Form.Action = Intelligencia.UrlRewriter.RewriterHttpModule.RawUrl;
    }
}


解决方案

asp.net 4.0?如果是这样,这里是你的答案是:<一href=\"http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770154\">http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770154;这不是一个简单的阅读,我不熟悉自己,所以你应该读它,看看它如何影响您的网站。

I have an ASP.net webforms site, with a server form in the masterpage, as all pages require it.

When debugging the action parameter is populated at runtime along with the id, but when deployed on my server with IIS7 it doesn't appear... but still works. It's not causing the site issues, but its making my W3C HTML5 validation fail, as it needs to be populated.

Debug source:

<form method="post" action="index.aspx" id="aspnetForm">

Live source:

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

Form declaration in masterpage:

<form runat="server">
.. some divs
</form>

I know the form tag doesnt have ID/action defined etc, because ASP configures the default at runtime and thats fine, although for some reason it messes up on my server. I've tried using the action="<% Path etc %>", to get the path name but it doesn't work.

What am I doing wrong? Am I missing something, or is it just bad practise to use a form in a masterpage?

Thanks.

Update

Ok, to solve the issue pointed out in the answer I just set the Form.Action on the Masterpage Page_Load, finally got that W3C green light!

Note: I'm using Intelligencia Rewriter, but you can pull the URL using Request.Url

public partial class myMasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Form.Action = Intelligencia.UrlRewriter.RewriterHttpModule.RawUrl;
    }
}

解决方案

asp.net 4.0? If so, here's your answer: http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770154; It's not an easy read, and I'm not familiar myself, so you should probably read it and see how that affects your site.

这篇关于ASP.net不填充动作= QUOT;&QUOT;服务器形式发布的时候的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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