PostBackURL, Server.Transfer, and PreviousPage

  • Thread starter Thread starter michael.neel
  • Start date Start date
M

michael.neel

Here is the setup:

I have an SQL driven sitemap provider - when the user clicks on a
database generated link - /Site/DBPages/Article1.aspx - a handler does
a Server.Transfer - Server.Transfer("/Site/Template.aspx", true) - to a
template page which displays the database related content. The
Template page knows it's content because the page does exist in the SQL
sitemap provider.

The problem comes in with a button on /Site/Template.aspx - by default
it will post back to "/Site/Template.aspx" instead of the user's URL
bar value "/Site/DBPages/Article1.aspx" - so I set the button's
PostBackURL to "/Site/DBPages/Article1.aspx" and the page posts to the
correct page ok.

But Page.PreviousPage is null, Page.IsPostBack is false, and there is
no event information on the button click. Request.Params does have a
__PREVIOUSPAGE - it's just not getting used it seems.

I think the Server.Transfer on the postback is stripping off the
PreviousPage, but I'm not sure.

Mike
 
After all weekend of looking, the solution (workaround) I've come up
with is to look though the Request.Params for the name of the button
(which requires a little logic on it's own to parse the name from the
..net string) and then manually do all processing from Request.Params
ASP 1.1 style. This feels like a dirty hack, and I'm left wondering
if this is the way it's supposed to work or it's a bug.

Mike
 

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

Back
Top