pass data (string) to aspx page - not in url

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

I have a IHttpHandler that is generating a page. If it throws an exception I
want to put up a nice page that is based on my master page so it looks good.

How can I redirect from my IHttpHandler to my handle_error.aspx page passing
it the exception in the request, not in the url. I would prefer to pass the
filename, line number and Exception.Message string but I can live with just
the Message.

How best to do this?
 
Here's another nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("handle_error.aspx ")

Then, in handle_error.aspx.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to another
besides the querystring there are cookies, session, context, saving to a
temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.

Here are more good articles on the subject:
http://www.aspalliance.com/kenc/passval.aspx
http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx
 

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