passing information between ASPX pages

Discussion in 'ASP .Net' started by francois, Jan 9, 2004.

  1. francois

    francois Guest

    I would like to pass information between ASPX pages.

    For now, my navigation are hardcoded links.
    In some case I do a Response.Redirect("pages.aspx")

    Now I wonder is this is a good way to do.

    For exemple when I log out of my website, i go back to the logon page but I
    would like to write on the logon page something like "you succesfully logged
    out".
    Doing the following does not work :
    Response.Write("Sucessfully Logged out!");
    Response.Redirect("Logon.aspx");
    (I assume a new Response objet is created when i redirect, right?)

    Then should I do something like
    Response.Redirect("Logon.aspx?message='Sucessfully Logged out!'");

    But this may lead in problems and string encoding (as my websites would use
    many languages including chinese and japanese)

    Then how is the proper, (state of the art :p) way to achieve my goal?

    Thanks

    Francois
     
    francois, Jan 9, 2004
    #1
    1. Advertising

  2. francois

    Curt_C [MVP] Guest

    Well.... this:
    Response.Write("Sucessfully Logged out!");
    Response.Redirect("Logon.aspx");
    does work...it jsut doesn't have time to send it to the browser.
    You can pass the message with a URLEncode() to make sure it's not going to
    break the URL

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    www.Darkfalz.com


    "francois" <_NOSPAM> wrote in message
    news:%...
    > I would like to pass information between ASPX pages.
    >
    > For now, my navigation are hardcoded links.
    > In some case I do a Response.Redirect("pages.aspx")
    >
    > Now I wonder is this is a good way to do.
    >
    > For exemple when I log out of my website, i go back to the logon page but

    I
    > would like to write on the logon page something like "you succesfully

    logged
    > out".
    > Doing the following does not work :
    > Response.Write("Sucessfully Logged out!");
    > Response.Redirect("Logon.aspx");
    > (I assume a new Response objet is created when i redirect, right?)
    >
    > Then should I do something like
    > Response.Redirect("Logon.aspx?message='Sucessfully Logged out!'");
    >
    > But this may lead in problems and string encoding (as my websites would

    use
    > many languages including chinese and japanese)
    >
    > Then how is the proper, (state of the art :p) way to achieve my goal?
    >
    > Thanks
    >
    > Francois
    >
    >
     
    Curt_C [MVP], Jan 9, 2004
    #2
    1. Advertising

  3. As you put it, i don't know if this is the "state of the
    art" way. But if you have reasons not to use
    Response.Redirect (a.aspx?message=hello); (QueryString[]
    i mean), then why not use Session Variables?

    Session Variables will work with any language you may
    want.

    Let me know if this is what you wanted

    Regards,

    Michelle


    >-----Original Message-----
    >I would like to pass information between ASPX pages.
    >
    >For now, my navigation are hardcoded links.
    >In some case I do a Response.Redirect("pages.aspx")
    >
    >Now I wonder is this is a good way to do.
    >
    >For exemple when I log out of my website, i go back to

    the logon page but I
    >would like to write on the logon page something

    like "you succesfully logged
    >out".
    >Doing the following does not work :
    >Response.Write("Sucessfully Logged out!");
    >Response.Redirect("Logon.aspx");
    >(I assume a new Response objet is created when i

    redirect, right?)
    >
    >Then should I do something like
    >Response.Redirect("Logon.aspx?message='Sucessfully

    Logged out!'");
    >
    >But this may lead in problems and string encoding (as my

    websites would use
    >many languages including chinese and japanese)
    >
    >Then how is the proper, (state of the art :p) way to

    achieve my goal?
    >
    >Thanks
    >
    >Francois
    >
    >
    >.
    >
     
    Michelle Stone, Jan 9, 2004
    #3
  4. > Well.... this:
    > Response.Write("Sucessfully Logged out!");
    > Response.Redirect("Logon.aspx");
    > does work...it jsut doesn't have time to send it to the browser.
    > You can pass the message with a URLEncode() to make sure it's not going to
    > break the URL


    avoid having pages of the form:
    someURL?message=text

    cause other people can exploit it (say from spam e-mails) to show any text
    to users as if your site was showing it (they just make the appropriate URL
    and send a page/e-mail with such a link to an unsuspected user saying you
    sent it). Even MCAfee had such silly URLs some time ago, not sure if they
    fixed them, at least I gave them a warning

    Use session variables instead - log off the user when the login page is
    (re)visited (if you see the user already has some name variable that isn't
    equal to null/nothing at the session they were in so log them out and say
    goodbye with their name, else don't do anything). To log off just do a
    redirection to the login page then which will log the user out and before
    logging them out will get their name from the session data and display the
    goodbye message etc.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    George Birbilis <>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
    + Plugs VCL and ActiveX controls (InterProcess/Internet communication)
    + TransFormations, VB6 forms to ASP.net WebForms convertion
    http://www.kagi.com/birbilis
    + Robotics
    http://www.mech.upatras.gr/~robgroup
    .........................................................................
     
    George Birbilis, Jan 9, 2004
    #4
  5. francois

    Curt_C [MVP] Guest

    Not always. Sessions are not always the way either. I would however encode
    the URL, or rather encrypt it.... for less threat of a hack attack...

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    www.Darkfalz.com


    "George Birbilis" <> wrote in message
    news:...
    > > Well.... this:
    > > Response.Write("Sucessfully Logged out!");
    > > Response.Redirect("Logon.aspx");
    > > does work...it jsut doesn't have time to send it to the browser.
    > > You can pass the message with a URLEncode() to make sure it's not going

    to
    > > break the URL

    >
    > avoid having pages of the form:
    > someURL?message=text
    >
    > cause other people can exploit it (say from spam e-mails) to show any text
    > to users as if your site was showing it (they just make the appropriate

    URL
    > and send a page/e-mail with such a link to an unsuspected user saying you
    > sent it). Even MCAfee had such silly URLs some time ago, not sure if they
    > fixed them, at least I gave them a warning
    >
    > Use session variables instead - log off the user when the login page is
    > (re)visited (if you see the user already has some name variable that isn't
    > equal to null/nothing at the session they were in so log them out and say
    > goodbye with their name, else don't do anything). To log off just do a
    > redirection to the login page then which will log the user out and before
    > logging them out will get their name from the session data and display the
    > goodbye message etc.
    >
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > George Birbilis <>
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > + QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
    > + Plugs VCL and ActiveX controls (InterProcess/Internet communication)
    > + TransFormations, VB6 forms to ASP.net WebForms convertion
    > http://www.kagi.com/birbilis
    > + Robotics
    > http://www.mech.upatras.gr/~robgroup
    > ........................................................................
    >
    >
     
    Curt_C [MVP], Jan 9, 2004
    #5
  6. francois

    RAMADU Guest


    >-----Original Message-----
    >I would like to pass information between ASPX pages.
    >
    >For now, my navigation are hardcoded links.
    >In some case I do a Response.Redirect("pages.aspx")
    >
    >Now I wonder is this is a good way to do.
    >
    >For exemple when I log out of my website, i go back to

    the logon page but I
    >would like to write on the logon page something like "you

    succesfully logged
    >out".
    >Doing the following does not work :
    >Response.Write("Sucessfully Logged out!");
    >Response.Redirect("Logon.aspx");
    >(I assume a new Response objet is created when i

    redirect, right?)
    >
    >Then should I do something like
    >Response.Redirect("Logon.aspx?message='Sucessfully Logged

    out!'");
    >
    >But this may lead in problems and string encoding (as my

    websites would use
    >many languages including chinese and japanese)
    >
    >Then how is the proper, (state of the art :p) way to

    achieve my goal?
    >
    >Thanks
    >
    >Francois


    Hi Francois,

    What you could do is to have a variable in the session
    which will check if the user is logging out or if the user
    is logging in for the first time. While loading the page,
    you can check if the session variable exists or not. If it
    does exist, then you can display the appropriate logout
    message. Else, you don't have to display any message.


    Regards,

    RAMADU
     
    RAMADU, Jan 12, 2004
    #6
    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. francois

    passing information between pages

    francois, Feb 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    388
    Michael Ramey
    Feb 3, 2004
  2. A Ward
    Replies:
    3
    Views:
    465
    bruce barker
    Aug 20, 2004
  3. John
    Replies:
    1
    Views:
    377
    Chris R. Timmons
    Apr 15, 2006
  4. Tim Almond

    Passing information between pages

    Tim Almond, Jul 18, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    149
    Tim Almond
    Jul 18, 2003
  5. 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,389
    Mirronelli
    Oct 22, 2005
Loading...

Share This Page