473,699 Members | 2,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.Transfer to ASP.old pages?

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

Nov 17 '05 #1
5 2645
Try Response.Redire ct. Server.Transfer works within the ASP.Net ISAPI, and
can never work with ASP pages. Response.Redire ct 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.

"Jon Sequeira" <js******@twcny .rr.com> wrote in message
news:u0******** ******@TK2MSFTN GP10.phx.gbl...
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

Nov 17 '05 #2
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.

"Ted" <co************ ***@DIThotmail. com> wrote in message
news:3f******** *************** @news.euronet.n l...
"Jon Sequeira" <js******@twcny .rr.com> wrote in message
news:e2******** ******@tk2msftn gp13.phx.gbl...
Thanks.

I'm looking for a way to do it without Response.Redire ct-- I'd like the
redirect to take place on the server, without the browser seeing the new
URL. The intention here is to create a similar effect to an URL
rewriter, so
that site users and search engines are not aware of the second, target

URL,
which contains a number of query string parameters that I don't wish to
expose.

Any ideas are appreciated.

--Jon


This is not possible. Also because Server.Redirect in ASP will not accept
'new' querystring parameters, only the ones that were sent by the browser
with the original request are available.

Ted

Nov 17 '05 #3
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.Http Application.Map HttpHandler),
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

"Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message
news:e7******** ******@TK2MSFTN GP10.phx.gbl...
Well, there is one way that I can think of. On the server side, you can
create a WebRequest, which is an HTTP request for a resource. The WebRequest can request the ASP page, which invokes the ASP ISAPI on the web server to
handle that request. The HTML Response from that Request can then be
returned to the browser using Response.Write from the ASP.Net Page class.

HTH,

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

"Jon Sequeira" <js******@twcny .rr.com> wrote in message
news:e2******** ******@tk2msftn gp13.phx.gbl...
Thanks.

I'm looking for a way to do it without Response.Redire ct-- I'd like the
redirect to take place on the server, without the browser seeing the new
URL. The intention here is to create a similar effect to an URL rewriter,
so
that site users and search engines are not aware of the second, target

URL,
which contains a number of query string parameters that I don't wish to
expose.

Any ideas are appreciated.

--Jon
"Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message
news:#C******** ******@TK2MSFTN GP11.phx.gbl...
Try Response.Redire ct. Server.Transfer works within the ASP.Net ISAPI,

and can never work with ASP pages. Response.Redire ct 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.

"Jon Sequeira" <js******@twcny .rr.com> wrote in message
news:u0******** ******@TK2MSFTN GP10.phx.gbl...
> 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
>
>
>



Nov 17 '05 #4
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.

"Jon Sequeira" <js******@twcny .rr.com> wrote in message
news:Od******** ******@TK2MSFTN GP10.phx.gbl...
Sorry, my post was a bit confusing. I was doing a test-of-theory by
referring to an ASP.NET page, to take advantage of the debugger (and because I'm trying to find a solution that won't need to be extensively rewritten
when the whole site is migrated to ASP.NET).

I think the problem is that for the page to be served correctly via a second HttpWebRequest, all of the relative links in the served page need to be
replaced with absolute URLs. Otherwise the page's form won't work, and
graphics and CSSs and includes can't be found, and so on.

At this point, rewriting the ASP page to be served this way may be nearly as much work as reimplementing it in ASP.NET. Unless I'm missing something.

Regards,

--Jon

"Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message
news:ue******** ******@tk2msftn gp13.phx.gbl...
As the ASP page in the browser is pure HTML, I have no idea what you're
referring to when you say "a bit crippled" and I have no idea what "stack
trace" you're referring to. From your description, the "stack trace" is a stack trace from an ASP.Net application. So I'm at a loss as to what you're
describing here.

HTH,

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

"Jon Sequeira" <js******@twcny .rr.com> wrote in message
news:eM******** ******@tk2msftn gp13.phx.gbl...
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.Http Application.Map HttpHandler), 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

"Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message
news:e7******** ******@TK2MSFTN GP10.phx.gbl...
> Well, there is one way that I can think of. On the server side, you can > create a WebRequest, which is an HTTP request for a resource. The
WebRequest
> can request the ASP page, which invokes the ASP ISAPI on the web server
to
> handle that request. The HTML Response from that Request can then be
> returned to the browser using Response.Write from the ASP.Net Page

class.
>
> HTH,
>
> Kevin Spencer
> Microsoft FrontPage MVP
> Internet Developer
> http://www.takempis.com
> Big things are made up of
> lots of Little things.
>
> "Jon Sequeira" <js******@twcny .rr.com> wrote in message
> news:e2******** ******@tk2msftn gp13.phx.gbl...
> > Thanks.
> >
> > I'm looking for a way to do it without Response.Redire ct-- I'd

like the
> > redirect to take place on the server, without the browser seeing
the new
> > URL. The intention here is to create a similar effect to an URL
rewriter,
> so
> > that site users and search engines are not aware of the second, target > URL,
> > which contains a number of query string parameters that I don't

wish to
> > expose.
> >
> > Any ideas are appreciated.
> >
> > --Jon
> >
> >
> > "Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message
> > news:#C******** ******@TK2MSFTN GP11.phx.gbl...
> > > Try Response.Redire ct. Server.Transfer works within the ASP.Net

ISAPI,
> and
> > > can never work with ASP pages. Response.Redire ct 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.
> > >
> > > "Jon Sequeira" <js******@twcny .rr.com> wrote in message
> > > news:u0******** ******@TK2MSFTN GP10.phx.gbl...
> > > > 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
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 17 '05 #5
Thanks. This should definitely work.

I appreciate your help.

--Jon

"Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
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.

"Jon Sequeira" <js******@twcny .rr.com> wrote in message
news:Od******** ******@TK2MSFTN GP10.phx.gbl...
Sorry, my post was a bit confusing. I was doing a test-of-theory by
referring to an ASP.NET page, to take advantage of the debugger (and because
I'm trying to find a solution that won't need to be extensively rewritten
when the whole site is migrated to ASP.NET).

I think the problem is that for the page to be served correctly via a

second
HttpWebRequest, all of the relative links in the served page need to be
replaced with absolute URLs. Otherwise the page's form won't work, and
graphics and CSSs and includes can't be found, and so on.

At this point, rewriting the ASP page to be served this way may be nearly as
much work as reimplementing it in ASP.NET. Unless I'm missing something.

Regards,

--Jon

"Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message
news:ue******** ******@tk2msftn gp13.phx.gbl...
As the ASP page in the browser is pure HTML, I have no idea what you're referring to when you say "a bit crippled" and I have no idea what
"stack trace" you're referring to. From your description, the "stack trace" is a
stack trace from an ASP.Net application. So I'm at a loss as to what

you're
describing here.

HTH,

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

"Jon Sequeira" <js******@twcny .rr.com> wrote in message
news:eM******** ******@tk2msftn gp13.phx.gbl...
> 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.Http Application.Map HttpHandler),
> 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
>
> "Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message
> news:e7******** ******@TK2MSFTN GP10.phx.gbl...
> > Well, there is one way that I can think of. On the server side,
you can
> > create a WebRequest, which is an HTTP request for a resource. The
> WebRequest
> > can request the ASP page, which invokes the ASP ISAPI on the web

server
to
> > handle that request. The HTML Response from that Request can then

be > > returned to the browser using Response.Write from the ASP.Net Page
class.
> >
> > HTH,
> >
> > Kevin Spencer
> > Microsoft FrontPage MVP
> > Internet Developer
> > http://www.takempis.com
> > Big things are made up of
> > lots of Little things.
> >
> > "Jon Sequeira" <js******@twcny .rr.com> wrote in message
> > news:e2******** ******@tk2msftn gp13.phx.gbl...
> > > Thanks.
> > >
> > > I'm looking for a way to do it without Response.Redire ct-- I'd

like the
> > > redirect to take place on the server, without the browser seeing the new
> > > URL. The intention here is to create a similar effect to an URL
> rewriter,
> > so
> > > that site users and search engines are not aware of the second,

target
> > URL,
> > > which contains a number of query string parameters that I don't wish to
> > > expose.
> > >
> > > Any ideas are appreciated.
> > >
> > > --Jon
> > >
> > >
> > > "Kevin Spencer" <ke***@SPAMMERS SUCKtakempis.co m> wrote in message > > > news:#C******** ******@TK2MSFTN GP11.phx.gbl...
> > > > Try Response.Redire ct. Server.Transfer works within the ASP.Net ISAPI,
> > and
> > > > can never work with ASP pages. Response.Redire ct 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.
> > > >
> > > > "Jon Sequeira" <js******@twcny .rr.com> wrote in message
> > > > news:u0******** ******@TK2MSFTN GP10.phx.gbl...
> > > > > 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
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2472
by: Drew | last post by:
I have a server.transfer question. I have a page that utilizes the server.transfer method. On the page that is transfered to - lets say page 2, I want to do another server.transfer. This gives me the error: System.InvalidCastException: Specified cast is not valid. What is the proper way to do this type of page navigation? Thanks - Drew
5
2749
by: Paul de Goede | last post by:
I set the Response.Filter in my aspnet application but I have noticed that if you do a Server.Transfer that the filter doesn't get called. And in actual fact the response is mostly empty. It seems that only scripts get rendered. I have seen this mentioned on this newsgroup before but with no resolution. Can anyone give any insight into this problem. Is there a work around? Manually push the Reponse.OutputStream through your filter after...
3
2137
by: Manuel Lopez | last post by:
Hello, We have two applications that will reside on the same webserver. We want to be able to post from pages in App1 to to pages in App2. We need to pass sensible data, so we cannot use querystring. We are using server.transfer (needing to reference App2 in App1).
4
4884
by: Bob H | last post by:
Hi, I'm aware of the different ways to pass variables between ASP.Net pages. For pages that need to pass a variable, we're using the server.transfer method. For others, we're using repsonse.redirect. My understanding was that the server.transfer method doesn't update the URL address bar. However, I've a situation that I'm a bit confused about and would appreciate any advice on why the following is occuring (i.e. why I'm obviously missing...
3
1939
by: Steve Lutz | last post by:
Hello All, I have an ASPX page whose class inherits from a company global base page. The company base page has a property call PageTitle (string) that is assigned by all the pages. The base class also includes a class that is used for logging. This logging class uses HttpContext.Current.Handler to get the instance of the page. In this way, it can get the PageTitle property.
8
3897
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the Transfer method, but everything gets me the same error 500. Any help would be appreciated.
8
1829
by: p3t3r | last post by:
I am using .NET2 and have a number of aspx pages. On each page is a LinkButton that performs a server.transfer() to another page. If we use page names A,B,C,D,E as an example. I start on page A and do a server.transfer to page B. The address bar still shows page A (which is what I want). Page B then does a server.transfer to page C. Now the address bar shows the URL for page B (not C and not A which is what I want). Every new...
3
4205
by: Kondapanaidu | last post by:
Server.transfer("path of html file") I know that server.transfer wont process html pages. What could be the reason? Is there any way to run html pages in server.transfer Regards
3
2030
by: Peter Nofelt | last post by:
On Server.Transfer(), is there a reason why the previous page's elements would appear on the new page? Note: this transfer is occuring between two pages on the same server. <Scenario> I'm using Page.Context.Items and Server.Transfer to communicate between two pages (lets call them page1.aspx and page2.aspx). On postback to page1.aspx I preform a Server.Transfer() to page2.aspx. The transfer occurs, but page2.aspx renders incorrectly....
4
4009
by: evantay | last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties from my master pages within a page that inherits from that master page (a child page). However the values are always null. In my masterpage I have this: private bool m_AlreadyTested; public bool AlreadyTested { get { return m_AlreadyTested; }
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7750
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.