PostbackUrl and Context.Items

Discussion in 'ASP General' started by Wendy, Apr 5, 2006.

  1. Wendy

    Wendy Guest

    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!
     
    Wendy, Apr 5, 2006
    #1
    1. Advertising

  2. 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
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 5, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VS_NET_DEV
    Replies:
    2
    Views:
    3,827
    jenny
    May 25, 2004
  2. Replies:
    0
    Views:
    2,504
  3. =?Utf-8?B?V2VuZHk=?=

    Postbackurl and Context.Items

    =?Utf-8?B?V2VuZHk=?=, Apr 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    468
    =?Utf-8?B?V2VuZHk=?=
    Apr 10, 2006
  4. Fabio Mastria
    Replies:
    2
    Views:
    2,577
  5. Norah Jones
    Replies:
    0
    Views:
    118
    Norah Jones
    Apr 7, 2014
Loading...

Share This Page