简体   繁体   English

URL重写,回发事件时更改URL

[英]URL Rewrite , url change on postback event

I am currently working on classic asp application and we have URL rewrite pages. 我目前正在研究经典的ASP应用程序,并且我们有URL重写页面。

In those pages, we have small form which I have to validate. 在这些页面中,我们有一个必须验证的小表格。 When I press the submit button it validates the page but change the URL of the page. 当我按下提交按钮时,它将验证页面,但会更改页面的URL。

I want to stop changing URL. 我想停止更改URL。

I had same issue with ASP.NET C# so I used Form1.Action = Request.RawUrl; 我在ASP.NET C#中遇到了同样的问题,因此我使用了Form1.Action = Request.RawUrl;

How can I do same with classic asp application? 我如何用经典的ASP应用程序做同样的事情?

The equivalent of Request.RawUrl is 相当于Request.RawUrl

dim myUrl
myUrl = Request.ServerVariables("URL")

So 所以

<Form action=<%=myUrl%> 'and the rest of the details  

However, the Request.ServerVariables("URL") doesn't include the querystring (if present). 但是, Request.ServerVariables("URL")不包含querystring (如果存在)。

If you need that, then you'll have to build it manually, do something like 如果需要,则必须手动进行构建,例如

dim myUrl
myUrl = Request.ServerVariables("URL") & "?" & Request.QueryString

(you may want to put in an if else statement to make this cleaner). (您可能希望添加if else语句以使此方法更清洁)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM