passing information between ASPX pages

F

francois

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
 
C

Curt_C [MVP]

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
 
M

Michelle Stone

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
 
G

George Birbilis

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 <[email protected]>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 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
.........................................................................
 
C

Curt_C [MVP]

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...
 
R

RAMADU

-----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
 

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,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top