Server.Transfer to ASP.old pages?

J

Jon Sequeira

Is there a way to redirect from an ASP.NET page to an ASP page without
showing the ASP page's URL in the client's browser?

This works perfectly with an HTML page, for example:

path = "~/cp/test.htm"
Server.Transfer(path, False)

But with an .asp extension, the I get an HttpException, "Error executing
child request for ~/cp/test.asp."

I suppose the ASP.NET page factory is trying to execute the ASP page.

If anyone has suggestions on another way to accomplish this, I'm very
curious.

Thanks.

--Jon
 
K

Kevin Spencer

Try Response.Redirect. Server.Transfer works within the ASP.Net ISAPI, and
can never work with ASP pages. Response.Redirect sends a redirect request to
the browser, which then requests the ASP page appropriately.

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of
lots of Little things.
 
K

Kevin Spencer

Hi Ted,

I thought so too at first. However, if you look at my second response, I
think you'll agree that I've come up with a solution that should work.

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of
lots of Little things.
 
J

Jon Sequeira

This is almost working. It does serve up the desired page, but THAT page is
a bit crippled. Its form doesn't submit properly (the stack trace shops an
HttpException being thrown on System.Web.HttpApplication.MapHttpHandler),
and the served page's CSS is missing.

Do you have any sense of how easily these issues can be dealt with? (In a
pure ASP.NET scheme, I can implement an URL rewriter using an HttpModule and
I think it will be pretty simple. Since these ASP pages need to be rewritten
eventually anyway, I'm considering skipping right to that step.)

Thanks for your input.

--Jon
 
K

Kevin Spencer

I see what you mean. I believe this could be fairly easily accomplished, as
you know the path to the requested file, and the path to the current file.
From there, it is a (fairly) simple matter of parsing the string returned in
the Response from the WebRequest, and replacing relative paths with absolute
paths. You should be able to locate and Replace the URLs using Regular
Expressions.

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of
lots of Little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,573
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top