Server.Transfer chaging URL in address bar

G

Guest

I have an ASP.Net 1.1 site that uses Server.Transfer() heavily. Specifically,
I use a page called /misc/pagenotfound.aspx to implement logic that maps URLs
of the format /vdir/california to a physical page, called with the format
/vdir/state.aspx?id=CA. The first of these URLs can be used to call up the
page by the visitors. Because this page doesn't exist PageNotFound.aspx is
loaded (I have configured this in web.config), which uses Server.Transfer to
invoke the state.aspx page (the physical page on my server). Here's the
important part - the address bar in the browser still displays
/vdir/california so all this plumbing is hidden to the visitor. That's
exactly what I want.

However, now that I am using the same page on an ASP.Net 2.0 site I am
seeing a different behaviour. The state.aspx file is still called and the
correct content (based on id=ca) is displayed. However, the address bar
displays the URL to PageNotFound. aspx - /vdir/california is not displayed.

How can I ensure that the actually URL used by the visitor remains in the
address bar, even when Server.Transfer is used?

Thanks.
 
C

Cowboy \(Gregory A. Beamer\)

It sounds, to me, like you are throwing an error and the error is sending
the person to the "not found" page. Is that a possibility in the coding of
your application?
 
G

Guest

Actually, yes, but that is by design. I have configured the defaultRedirect
element in eb.config and the page I have entered is being called for all
errors, as hoped. The codebehind for the pagenotfound.aspx file then kicks in
to parse the original URL to map it to the physical URL. This all seems to be
working just fine because the correct page is being displayed. The "only"
problem I have is that the original URL entered should remain in the browsers
address bar but, instead, I am seeing a reference to pagenotfound.aspx.

So, to sum this up, the only error is the regular 404 (page not found) I am
anticipating and coding for. But I can't stop the pagenotfound.aspx file
showing up in the address bar.

Thanks.

Mark
 
G

Guest

I should clarify what I meant here. There is no "intentional" (coded)
throwing of errors happening here. The only error involved is a 404 (Page Not
Found) and my entry in web.config is there to tell the system how to handle
that event. As I mentioned in the open message here, all the plumbing seems
to be in place because I do see the correct content, as parsed/redirected by
my pagenotfound.aspx file. The problem I have is that the address bar shows
as follows:

http://<site>/misc/pagenotfound.aspx?aspxerrorpath=/articles/songs.aspx

What I expect to see in the address bar is:

http://<site>/articles/songs.aspx

which is what happens on my ASP.Net 1.1 site.

Any ideas?

Thanks.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top