Author |
Topic |
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-03-04 : 22:11:47
|
I have an aspx page on which I set some session variable in the code, then I want to refresh the page. Do I do just Post or is there an other method I can use to display the page with the new session valuesThanks |
|
karuna
Aged Yak Warrior
582 Posts |
Posted - 2006-03-05 : 22:32:51
|
Response.Redirect to the same page will help, This is not a postback, but a fresh request for that page, so whatever state your controls had will be lost.Just thinking.. why do you want to refresh after setting the session?ThanksKarunakaran |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-03-13 : 19:38:47
|
I m doing a page that refers to itself. The user is already on the page, then he clicks a link on the page, so when he clicks that link, i should check some of the things before I display the same page but according to the result of my checking.I think there is something that s performed by the server when I do Response.redirect(''the same page'') but which is not performed when the page is merely posted back automatically without putting Response.redirect(''same page'') , weird.Thanks |
 |
|
twhelan1
Yak Posting Veteran
71 Posts |
Posted - 2006-03-14 : 09:09:46
|
Response.Redirect is the same as the user going to the page for the first time. If you don't do Response.Redirect and instead post back to the page, it's the same as a form submit. That's the difference. In you're case you probably want to post back to the page rather than redirect to it.~Travis |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-03-15 : 14:44:02
|
Is it possible that ''Redirect.response'' refreshes and removes all the previous values from the controls of the page, whereas Postback keeps the values and redisplays them. Because i get different behaviours depending on wheither I do response.redirect or if I just allow the normal PostBackI think there is a difference in the way the previous controls values are displayed.Thanks |
 |
|
twhelan1
Yak Posting Veteran
71 Posts |
Posted - 2006-03-15 : 15:14:07
|
Response.Redirect is a complete reload of the page. It's as if the user is visiting the page for the very first time and no values have been set at all. So yes, Response.Redirect is removing all the previous values from the controls of the page. Postback is posting the values of the controls to the page for processing. The controls maintain their value after a postback and you can then manipulate them. If you're familiar with plain ASP instead of .Net, here's some code to try to explain the difference.A Postback in ASP.Net is similar to the following assuming that the current page is me.asp and the user clicks the Submit button:<form method="post" action="me.asp"> <input type="submit">Submit</submit></form>Response.Redirect is the same as if the user clicks a normal HTML link like <a href="me.asp">click me</a>. Is that clearer?~Travis |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-03-15 : 17:41:48
|
very clear, thanks a lot, muchas gracias |
 |
|
sachinsqldb
Starting Member
8 Posts |
Posted - 2006-04-11 : 07:04:40
|
My added suggestion here would be to add<META HTTP-EQUIV="Pragma" CONTENT="no-cache"><META HTTP-EQUIV="Expires" CONTENT="-1">in the top of the HTML so as not to force the browser to load from the cache (which is the default behaviour of major browsers)Regards,Sachin |
 |
|
|