Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > PostbackUrl and Context.Items

Thread Tools

PostbackUrl and Context.Items

Posts: n/a
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!
Reply With Quote
Bob Barrows [MVP]
Posts: n/a
Wendy wrote:
> 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.
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable a button via javascript with PostBackUrl set -> the postbackurl doesn't work Fabio Mastria ASP .Net 2 03-04-2008 09:23 AM
Postbackurl and Context.Items =?Utf-8?B?V2VuZHk=?= ASP .Net 0 04-10-2006 08:05 PM
Why does postbackurl and master pages work like this? ASP .Net 6 04-09-2006 11:49 PM
Context.Items and Postbackurl in ASP.NET 2.0 ASP .Net 0 04-03-2006 06:48 PM
PostBackUrl and Retrieving Values from User Controls osh ASP .Net 1 02-25-2006 06:58 PM