473,698 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple Postback using Session Variable

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("PageAc tion") = "view2" Then
Response.Write "Results"

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

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

<%
Session.Content s.RemoveAll()
Session("PageAc tion") = "view2"
%>
<input type="submit" value="View Results" name="submit1">

<%
End If
%>
Jul 19 '05 #1
5 4792
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*********@ms n.com> wrote in message
news:uX******** ******@TK2MSFTN GP12.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("PageAc tion") = "view2" Then
Response.Write "Results"

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

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

<%
Session.Content s.RemoveAll()
Session("PageAc tion") = "view2"
%>
<input type="submit" value="View Results" name="submit1">

<%
End If
%>

Jul 19 '05 #2
it was the _

ip address fixed it. thanks.

"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:er******** ********@TK2MSF TNGP12.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*********@ms n.com> wrote in message
news:uX******** ******@TK2MSFTN GP12.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("PageAc tion") = "view2" Then
Response.Write "Results"

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

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

<%
Session.Content s.RemoveAll()
Session("PageAc tion") = "view2"
%>
<input type="submit" value="View Results" name="submit1">

<%
End If
%>


Jul 19 '05 #3
-----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*********@ms n.com> wrote in message
news:uX******* *******@TK2MSFT NGP12.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("PageAc tion") = "view2" Then
Response.Write "Results"

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

<form name="myform" method="post" action="postbac k.asp">
<%
Session.Content s.RemoveAll()
Session("PageAc tion") = "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
> 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
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******@ielear ning.com
http://www.ielearning.com
714.637.9480 x17
"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:eM******** ******@TK2MSFTN GP11.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2029
by: Darrel | last post by:
I'm dimming a string at the top of my page so I can use it in several different subs on the page. I'm setting the text in one sub and then reading it in several. I'd like to also use this varable on postback. The catch is, since I'm dimming it at the top of the page, it resets itself on postback. The fix I cam up with is to, on page load, populate a hidden field with the value I want, then read that back on postback. But is there a...
2
1295
by: gce | last post by:
Hi, My project uses some aspx that jump to eachother. Session variables are used to exchange data. But my session variables are not there until a postback. So when I put a button on the second aspx and put there a show session("aaa") it works. But not in the page_load, session("aaa") is empty. Please help. Best regards, Gert
0
2288
by: jonelling | last post by:
I am having a problem where the page load event is not being fired for certain user controls that I load dynamically in placeholders. Here is what I'm doing in brief, with full test code supplied at the bottom. In my controlling .aspx page, in the page_init() sub, if not postback, I load two user controls and place them in placeholders. This works and a trace statement in each user control's page load handler is executed on initial...
4
1339
by: needin4mation | last post by:
I am inserting a row in a database. All that works fine. What I now need is the last inserted id from the database. I can get that. Again all working. Then what I need to have is that same last inserted id key to be available when the page reloads. When I press the button to insert the data, I can do this: Session("last")=LAST_ID; Response.Write("My row id is: " + Session("last"));
2
2196
by: COHENMARVIN | last post by:
I have a form with a Submit button. The user fills out the form, clicks the submit button, and then the page posts back to itself. Every time the page posts back to itself, the "Page_Load" event fires. So if the user first types the URL of the page in the browser, the "Page_Load" event fires. Then he hits submit, and the form contents are posted back, so the "Page_Load" event fires again. The form appears again (I clear its contents),...
4
1526
by: Jon Paal | last post by:
I captured an arraylist into a session value but to display the current values, the page requires a postback or else it displays the prior version of the value. how do I force a post back automatically so I can always get the current value stored in the session object ?
2
4005
by: paulcis | last post by:
I am trying to produce a dynamic form from a database with unknown amount of records. I need to read the values and create a new textbox for each. I need to create the textboxes at page_init stage as indicated by microsoft. But I can't seem to save the number of controls in a viewstate variable or a session variable when creating them in page_init . see code below
8
6900
by: Mel | last post by:
I have several text boxes and drop-down lists in an AJAX Update Panel. All user inputs have the Postback property set to True. After I type something in the first input entry and press the "Tab" key how can I set the focus to the next box after the postback? Please help! Using Visual Studio 2005 Pro, Asp.net 2.0, vb.net, WinXP
4
4003
by: tiago.private | last post by:
Hi everybody, Imagine the following scenario: One System.Web.UI.UserControl (UC1) with 2 drop downs and one button "Filter" One Webform with (UC1) and a GridView, basically the UC1 provides the options to the user to restrict (filter) the grid. The user changes the drop downs and then uses the Filter button to filter data (grid) that is the correct behavior.
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.