English 中文(简体)
使用 BaseHREF校正 ASP.net 中的 URL 提交表格以校正 URL
原标题:Submitting form to correct URL in ASP.net using BaseHREF

出于不可避免的设计原因,在我的顶层MasterPage 我的头标签上有:

<base href="http://127.0.0.1/" />

我无法使用的页面的 URL 是:

http://127.0.0.1/store/checkout

content page 我拥有控制权 :

<asp:Button runat="server" Text="Payment ▶" />

然而,当点击时,它将表格张贴到:

http://127.0.0.1/checkout

投出404, 因为它不是应该的 storee/ checkout

我如何解决这个问题, 才能将表格贴在正确的 URL 上, 且该表必须“ 坚固 > / 坚固” 优雅地降级, 如果联署材料被禁用, 它会正确张贴, 这就是为什么我不能接受任何 Javascript 解决方案!

问题回答

道克,我为此挣扎了好几天

在主页上,我创造了一个新的方法:

public void changeFormAction(string Action)
{
    MainForm.Action = Action;
}

然后从内容页面我叫:

Master.changeFormAction("/store/checkout");

这个能修好它!





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签