Passing data between pages?

Discussion in 'ASP .Net' started by Smokey Grindle, Jun 23, 2006.

  1. For a website that has users logged into it using sessions, its it best to
    pass data between pages in session variables or through query strings?
    Smokey Grindle, Jun 23, 2006
    #1
    1. Advertising

  2. Smokey Grindle

    Ethan V Guest

    My preference is to use Server.Transfer and HTTPContext.Items to pass data
    between pages, and I am willing to live with out-of-sync URL. I minimize the
    use of session to absolute mininal for resource conservation reason. I do
    not use query string ask I don't like people hacking with the query strings.
    If I were to use query string I would encrypt it.

    "Smokey Grindle" <> wrote in message
    news:...
    > For a website that has users logged into it using sessions, its it best to
    > pass data between pages in session variables or through query strings?
    >
    >
    Ethan V, Jun 23, 2006
    #2
    1. Advertising

  3. Smokey Grindle

    Scott M. Guest

    It depends on what data you are passing, how much data you are passing and
    how that data will be used.

    If the data needs to be secured or there will be more than 1K of data, then
    QueryStrings are out. On the other hand, sessions (if not used right) can
    be costly to the server and in web farm environments won't work.

    The most secure and robust way is to store the data in a database.

    "Smokey Grindle" <> wrote in message
    news:...
    > For a website that has users logged into it using sessions, its it best to
    > pass data between pages in session variables or through query strings?
    >
    >
    Scott M., Jun 23, 2006
    #3
  4. 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://SteveOrr.net/faq/PassValues.aspx
    http://www.aspalliance.com/kenc/passval.aspx
    http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Smokey Grindle" <> wrote in message
    news:...
    > For a website that has users logged into it using sessions, its it best to
    > pass data between pages in session variables or through query strings?
    >
    >
    Steve C. Orr [MVP, MCSD], Jun 23, 2006
    #4
  5. well for example I need to pass this set of information from page to page
    which may different pages may change the information..

    Folder (path on a hierachy of data currently on, string under 200 chars)
    MessageID (ID of node in the folder, Int64)
    ActionGUID (Unique ID of last action performed)

    besides that, not much else will be there...

    "Scott M." <> wrote in message
    news:...
    > It depends on what data you are passing, how much data you are passing and
    > how that data will be used.
    >
    > If the data needs to be secured or there will be more than 1K of data,
    > then QueryStrings are out. On the other hand, sessions (if not used
    > right) can be costly to the server and in web farm environments won't
    > work.
    >
    > The most secure and robust way is to store the data in a database.
    >
    > "Smokey Grindle" <> wrote in message
    > news:...
    >> For a website that has users logged into it using sessions, its it best
    >> to pass data between pages in session variables or through query strings?
    >>
    >>

    >
    >
    Smokey Grindle, Jun 23, 2006
    #5
  6. Smokey Grindle

    Scott M. Guest

    And what if someone hacks your querystring by forcing different data into
    it?


    "Smokey Grindle" <> wrote in message
    news:u%...
    > well for example I need to pass this set of information from page to page
    > which may different pages may change the information..
    >
    > Folder (path on a hierachy of data currently on, string under 200 chars)
    > MessageID (ID of node in the folder, Int64)
    > ActionGUID (Unique ID of last action performed)
    >
    > besides that, not much else will be there...
    >
    > "Scott M." <> wrote in message
    > news:...
    >> It depends on what data you are passing, how much data you are passing
    >> and how that data will be used.
    >>
    >> If the data needs to be secured or there will be more than 1K of data,
    >> then QueryStrings are out. On the other hand, sessions (if not used
    >> right) can be costly to the server and in web farm environments won't
    >> work.
    >>
    >> The most secure and robust way is to store the data in a database.
    >>
    >> "Smokey Grindle" <> wrote in message
    >> news:...
    >>> For a website that has users logged into it using sessions, its it best
    >>> to pass data between pages in session variables or through query
    >>> strings?
    >>>
    >>>

    >>
    >>

    >
    >
    Scott M., Jun 23, 2006
    #6
  7. That's the point of asking whats the best method of doing this, I'm trying
    to get rid of query strings, I just dont know how best to handle it

    "Scott M." <> wrote in message
    news:...
    > And what if someone hacks your querystring by forcing different data into
    > it?
    >
    >
    > "Smokey Grindle" <> wrote in message
    > news:u%...
    >> well for example I need to pass this set of information from page to page
    >> which may different pages may change the information..
    >>
    >> Folder (path on a hierachy of data currently on, string under 200 chars)
    >> MessageID (ID of node in the folder, Int64)
    >> ActionGUID (Unique ID of last action performed)
    >>
    >> besides that, not much else will be there...
    >>
    >> "Scott M." <> wrote in message
    >> news:...
    >>> It depends on what data you are passing, how much data you are passing
    >>> and how that data will be used.
    >>>
    >>> If the data needs to be secured or there will be more than 1K of data,
    >>> then QueryStrings are out. On the other hand, sessions (if not used
    >>> right) can be costly to the server and in web farm environments won't
    >>> work.
    >>>
    >>> The most secure and robust way is to store the data in a database.
    >>>
    >>> "Smokey Grindle" <> wrote in message
    >>> news:...
    >>>> For a website that has users logged into it using sessions, its it best
    >>>> to pass data between pages in session variables or through query
    >>>> strings?
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    Smokey Grindle, Jun 23, 2006
    #7
  8. Smokey Grindle

    Scott M. Guest

    Well, if you see my first response, I mentioned that if security is an
    issue, QueryStrings are out.


    "Scott M." <> wrote in message
    news:...
    > And what if someone hacks your querystring by forcing different data into
    > it?
    >
    >
    > "Smokey Grindle" <> wrote in message
    > news:u%...
    >> well for example I need to pass this set of information from page to page
    >> which may different pages may change the information..
    >>
    >> Folder (path on a hierachy of data currently on, string under 200 chars)
    >> MessageID (ID of node in the folder, Int64)
    >> ActionGUID (Unique ID of last action performed)
    >>
    >> besides that, not much else will be there...
    >>
    >> "Scott M." <> wrote in message
    >> news:...
    >>> It depends on what data you are passing, how much data you are passing
    >>> and how that data will be used.
    >>>
    >>> If the data needs to be secured or there will be more than 1K of data,
    >>> then QueryStrings are out. On the other hand, sessions (if not used
    >>> right) can be costly to the server and in web farm environments won't
    >>> work.
    >>>
    >>> The most secure and robust way is to store the data in a database.
    >>>
    >>> "Smokey Grindle" <> wrote in message
    >>> news:...
    >>>> For a website that has users logged into it using sessions, its it best
    >>>> to pass data between pages in session variables or through query
    >>>> strings?
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    Scott M., Jun 23, 2006
    #8
    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. roo
    Replies:
    2
    Views:
    359
  2. John
    Replies:
    0
    Views:
    307
  3. dbuchanan

    Passing data between pages

    dbuchanan, Jun 25, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    367
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Jun 25, 2008
  4. RadioSignal

    passing variables from .aspx.cs code pages to .aspx pages

    RadioSignal, Sep 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    7
    Views:
    2,230
    Mirronelli
    Oct 22, 2005
  5. Deepiceman

    passing data between 2 pages

    Deepiceman, Jun 23, 2004, in forum: ASP General
    Replies:
    1
    Views:
    126
    Bullschmidt
    Jun 24, 2004
Loading...

Share This Page