Evertjan. said:
Anthony Jones wrote on 04 dec 2006 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
Anthony Jones wrote on 04 dec 2006 in
microsoft.public.inetserver.asp.general:
[..]
You should've also noted in your solution that care should be taken
to remove those session values else the Session object could be
overburdened with unnecessary values that are no longer needed.
This can hurt the scalability of the application.
I am sorry but I am not convinced:
1 if the session variables are not available due to a reload from the
browsers history() the code can easily default back to another page.
That doesn't make any sense can you elobrate?
if session("ime") = "" then response.redirect "/"
Not very friendly to the user is it. By placing the values in the Session
instead of on the query string you give the user a poor experience if the
press the refresh button. Tell me again what advantage is this providing
host, client or user?
Not so important, unless you are planning to have loads of session
variables and thousands of concurrent sessions.
The technique you've described can result in just that, the build up of
loads of unwanted session variables.
It does:
If the page is client cache reloaded and the original querystring was
only used serverside, the page would be exactly the same with or without
the querystring being there.
No it won't. I thought I had made that plain. I'll try again with a
simpler worked example.
Take this page and call it fruit.asp :-
<%
Dim sFruit: sFruit = Session("Fruit")
Session.Contents.Remove("Fruit")
If IsEmpty(sFruit) Then sFruit = "Fruit? What fruit?"
Response.ContentType = "text/html"
Response.CharSet = "Windows-1252"
Response.Expires = 15
Response.CacheControl = "max-age:900"
%>
<html>
<body><%=sFruit%></body>
</html>
and this page we'll call it fruitredir.asp:-
<%
Session("fruit") = Request.QueryString("fruit")
Response.Redirect "fruit.asp"
%>
Visit /fruitredir.asp?fruit=apples. You get apples. Visit
/fruitredir.asp?fruit=oranges you still get apples. If you refresh, the
server has forgotten what fruit you wanted to talk about. Contrast that
with this:-
Fruit.asp:-
<%
Dim sFruit: sFruit = Request.QueryString("Fruit")
If IsEmpty(sFruit) Then sFruit = "Fruit? What fruit?"
Response.ContentType = "text/html"
Response.CharSet = "Windows-1252"
Response.Expires = 15
Response.CacheControl = "max-age:900"
%>
<html>
<body><%=sFruit%></body>
</html>
FruitRedir.asp:-
<%
Dim sFruit: sFruit = Request.QueryString("fruit")
Response.Redirect "fruit.asp?fruit=" & sFruit
%>
Visit /fruitredir.asp?fruit=bananas. You get bananas. Visit
/fruitredir.asp?fruit=grapes you get grapes. Press refresh you still have
grapes. Re-visit /fruitredir.asp?fruit=bananas and the
/fruit.asp?fruit=bananas resource is retrieved from the cache. This is ok
because it shows bananas and is what the original server intended to happen.
4 If you fear that session variables will overburden your server
better not use them at all, but that has not much to do with my
simple alternative to the missing querystring in a response.redirect.
An OP asking this OQ will not encounter that kind of problem, I am
quite certain.
Your probably right and yet the querystring solution is still the
appropriate solution in the OPs case.
5 Using response.redirect might be not the right solution at all if
you [general you] see so many ghost on that way. Server.transfer
might be a valid alternative in some cases.
Now at least we can agree on that.
I would never transport name/forname content in a querystring from one
page to the other, but keep them serverside once they are under my
control. The thought of them being kept in the browser address cache for
anyone to read! And for the first transport to serveside I would use
form/post.