简体   繁体   中英

Can we redirect to totally new page in httpurlmodule without using response.redirect or server.transfer

I tried some work using http handler and found that we can not execute .asp files and took the httpmodule route.

I have http module on the virtual directory which is a dotnet application.Once the request comes to dotnet http module , i want to redirect to asp file which is the root folder based on some logic in .net.

I don't want to use response.redirect here, that is the main thing

root/dotnetapplication.

dotnet application has the following code.

 application.Context.RewritePath("http://localwww.test.com/main.asp", false);

This is throwing the following exception

'

http://locwww.test.com/main.asp' is not a valid virtual path.

[HttpException (0x80004005): 'http://locwww.allposters.com/main.asp' is not a valid virtual path.]
   System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) +8855691
   System.Web.HttpContext.RewritePath(String path, Boolean rebaseClientPath) +116
   ADC.Web.Code.ApcUrlRewriteModule.UrlRewriteModule_BeginRequest(Object sender, EventArgs e) 
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Really appreciate your help.

.ASP is traditionally not a .NET application page unless you re-configured the .ASP extension.

My guess is that you do not have .ASP enabled and the server thinks "main.asp" is a virtual directory not a .ASP page:

Enabling ASP Pages in IIS 6.0

It means that you can only rewrite to another virtual path, meaning /somefolder/somefile.asp or aspx or whatever.

If you want to execute the asp page from another server and just serve the content it generates, you will need to "proxy" that page. That can be a .aspx page that makes a remote request or a proxy module for asp.net. I don't know of any, but I'm guessing there is one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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