By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Simple Postback using Session Variable

P: n/a
I'm trying to set a session variable after displaying a form, then capture
the Session variable on postback. For some reason, the below code always
returns the form, not the "Step 2" results part.

What am I doing wrong? It's on a local network server, not on the web if
that matters.

<%
'* Step 2: Display results
'**********************************************
If Session("PageAction") = "view2" Then
Response.Write "Results"

'* Step 1: Display form
'**********************************************
Else
%>

<form name="myform" method="post" action="postback.asp">

<%
Session.Contents.RemoveAll()
Session("PageAction") = "view2"
%>
<input type="submit" value="View Results" name="submit1">

<%
End If
%>
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
For some reason, your session variables are being discarded. See
http://www.aspfaq.com/2157 for some possible reasons (the most common reason
is that you are developing locally or on an intranet, and there is an
underscore in the name of the server you are connecting to).


"Scott" <sa*********@msn.com> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
I'm trying to set a session variable after displaying a form, then capture
the Session variable on postback. For some reason, the below code always
returns the form, not the "Step 2" results part.

What am I doing wrong? It's on a local network server, not on the web if
that matters.

<%
'* Step 2: Display results
'**********************************************
If Session("PageAction") = "view2" Then
Response.Write "Results"

'* Step 1: Display form
'**********************************************
Else
%>

<form name="myform" method="post" action="postback.asp">

<%
Session.Contents.RemoveAll()
Session("PageAction") = "view2"
%>
<input type="submit" value="View Results" name="submit1">

<%
End If
%>

Jul 19 '05 #2

P: n/a
it was the _

ip address fixed it. thanks.

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:er****************@TK2MSFTNGP12.phx.gbl...
For some reason, your session variables are being discarded. See
http://www.aspfaq.com/2157 for some possible reasons (the most common reason is that you are developing locally or on an intranet, and there is an
underscore in the name of the server you are connecting to).


"Scott" <sa*********@msn.com> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
I'm trying to set a session variable after displaying a form, then capture the Session variable on postback. For some reason, the below code always
returns the form, not the "Step 2" results part.

What am I doing wrong? It's on a local network server, not on the web if
that matters.

<%
'* Step 2: Display results
'**********************************************
If Session("PageAction") = "view2" Then
Response.Write "Results"

'* Step 1: Display form
'**********************************************
Else
%>

<form name="myform" method="post" action="postback.asp">

<%
Session.Contents.RemoveAll()
Session("PageAction") = "view2"
%>
<input type="submit" value="View Results" name="submit1">

<%
End If
%>


Jul 19 '05 #3

P: n/a
-----Original Message-----
For some reason, your session variables are being discarded. Seehttp://www.aspfaq.com/2157 for some possible reasons (the most common reasonis that you are developing locally or on an intranet, and there is anunderscore in the name of the server you are connecting to).

"Scott" <sa*********@msn.com> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
I'm trying to set a session variable after displaying a form, then capture the Session variable on postback. For some reason, the below code always returns the form, not the "Step 2" results part.

What am I doing wrong? It's on a local network server, not on the web if that matters.

<%
'* Step 2: Display results
'**********************************************
If Session("PageAction") = "view2" Then
Response.Write "Results"

'* Step 1: Display form
'**********************************************
Else
%>

<form name="myform" method="post" action="postback.asp">
<%
Session.Contents.RemoveAll()
Session("PageAction") = "view2"
%>
<input type="submit" value="View Results" name="submit1">
<%
End If
%>

.


mate, I was really pissed that my SESSION variables were
not working!!! it turns out on the IIS, DEFAULT WEB SITE
PROPERTIES, HOME DIRECTORY, CONFIGURATION, MAPPINGS I
unchecked the 'CACHE ISAPI APPLICATIONS OPTION' and that
was f@cking me up !!!
Jul 19 '05 #4

P: n/a
> mate, I was really pissed that my SESSION variables were
not working!!!


I'm not sure I understand why you're yelling at me about it?
Jul 19 '05 #5

P: n/a
Probably because you were convenient and when you spend a bunch of time
looking for a programming solution to a simple configuration problem you
want to yell at somebody (other than yourself)!

--
Mark Schupp
--
Head of Development
Integrity eLearning
Online Learning Solutions Provider
ms******@ielearning.com
http://www.ielearning.com
714.637.9480 x17
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:eM**************@TK2MSFTNGP11.phx.gbl...
mate, I was really pissed that my SESSION variables were
not working!!!


I'm not sure I understand why you're yelling at me about it?

Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.