Server.Transfer chaging URL in address bar

Server.Transfer chaging URL in address bar

am 29.05.2007 01:16:00 von mark

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.

Re: Server.Transfer chaging URL in address bar

am 29.05.2007 02:30:25 von NoSpamMgbworld

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?

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
"Mark" wrote in message
news:46722444-AB78-4C7F-8308-CC19B56F13FA@microsoft.com...
>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.

Re: Server.Transfer chaging URL in address bar

am 29.05.2007 03:38:01 von mark

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

"Cowboy (Gregory A. Beamer)" wrote:

> 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?
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com
> Co-author: Microsoft Expression Web Bible (upcoming)
>
> ************************************************
> Think outside the box!
> ************************************************
> "Mark" wrote in message
> news:46722444-AB78-4C7F-8308-CC19B56F13FA@microsoft.com...
> >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.
>
>
>

Re: Server.Transfer chaging URL in address bar

am 29.05.2007 21:13:02 von mark

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:///misc/pagenotfound.aspx?aspxerrorpath=/articles/songs.aspx

What I expect to see in the address bar is:

http:///articles/songs.aspx

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

Any ideas?

Thanks.


"Mark" wrote:

> 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
>
> "Cowboy (Gregory A. Beamer)" wrote:
>
> > 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?
> >
> > --
> > Gregory A. Beamer
> > MVP; MCP: +I, SE, SD, DBA
> > http://gregorybeamer.spaces.live.com
> > Co-author: Microsoft Expression Web Bible (upcoming)
> >
> > ************************************************
> > Think outside the box!
> > ************************************************
> > "Mark" wrote in message
> > news:46722444-AB78-4C7F-8308-CC19B56F13FA@microsoft.com...
> > >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.
> >
> >
> >