PostbackUrl and Context.Items

W

Wendy

I had previously posted this in inetserver.asp.components, I don't think that
was the right place... anyways, here is a repost:

We are currently using ASP.NET 2.0 to revamp one of our web applications. Let
me try to briefly explain how each page is laid out...

Usually within the page, there are 3 components... The header, the body, and
the footer. The header and footer are user controls created by one of our
developers, and contain things that all the pages in our web app should
contain. This is done to avoid inconsistencies (so you only change the header
once instead of changing it 20 times - once for each page).

The developer who created the header user control used Context.Items to
store some information. On my pages, I am trying to use PostbackUrl to post
form information from one page to another.

The problem I am having is this:
Both my pages call the header control. When I use PostbackUrl and
PreviousPage, I think the header control from the previous page gets "copied"
over to the page I am posting to. So in the second page, I get something like
a "dictionary keys have to be unique" exception. I think this is because the
Context.Items wasn't "cleared" from the PreviousPage since it was "copied"
over, so when the header user control tries to add the same key to
Context.Items in the second page, I get an exception.

I temporarily solved this problem by using Request.Form[...] rather than
PreviousPage.FindControl(...). I'm not sure if this is the right way to do
it, or if it will cause any problems.

So my question is: Can PostbackUrl and Context.Items work together? I guess
I could put some try/catch statements in the header control, but
unfortunately I don't have access to that file.

Thanks for your help!
 
B

Bob Barrows [MVP]

Wendy said:
I had previously posted this in inetserver.asp.components, I don't
think that was the right place... anyways, here is a repost:

We are currently using ASP.NET 2.0

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.

Unfortunately, I do not know the answer to your question.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top