Why is Session working for all users except one?

G

Guest

I'm having a problem saving session information on one form and retrieving it
on a subsequent form...for only one out of a number of users. Actually, I'm
not absolutely certain it's a session problem but I'm hoping the experts can
help me figure that out.

Our application uses a session variable to "pass" info from one form to the
next. It has always worked fine for our users until a few weeks ago when one
of our users started having a problem. Every time they would try to move from
Form #1 (DefectEdit1.aspx) to Form #2 (DefectEdit2.aspx), they would get
redirected to the application's home page, which is what Form #2 is supposed
to do whenever it doesn't find anything stored in the session variable (Form
#1 is supposed to have saved the session variable right before redirecting to
Form #2). So my assumption has been that there is a problem with the session
information being saved.

The problem seems to be machine dependent. All the other users are having no
problems with these forms on their own machines. The user in question does
not have a problem if he logs in on someone else's machine and uses the
application. Other users have the same problem if they go to this guy's
machine, even if they log in as themselves.

I figured there must be something in the Internet Options settings on his
machine that must be preventing him from saving session state. I made sure
that his IE Privacy settings were set to "Medium" (the default), which I
thought would allow most first-party cookies to be stored. I'm pretty sure
this is how the other users' machines are set up.
Didn't help. So we went to the Security tab and made sure that the
"Internet", "Local intranet", and "Trusted sites" zones were all set to the
"Default" security level for each zone. Still didn't help. Finally, we made
sure that the root web address for the application was added to the "Local
intranet" zone's list of sites on the Security tab, just to make sure that
the application was being forced into the default security settings for
"Local intranet". Still didn't help. The user is running XP Professional and
we've downloaded all current Windows updates.

Any help would be greatly appreciated. We've tried everything we can think
of at this point.

Thanks,
Scott Wickham



Here's the code from Form #2 that checks the session info:

// Page load
private void Page_Load(object sender, System.EventArgs e)
{
// If user doesn't have permission to view this page then redirect
if (CheckPermissions() == false)
Response.Redirect(Request.ApplicationPath +
"/Modules/Workflow/WorkflowActionsPending.aspx?Module=ncr");

if (this.IsPostBack)
return;

// If there is no PartInformation object in session then we didn't arrive
here from DefectEdit1, so redirect.
//
// ******* This is where the redirection is occurring *******
//
if (Session["PartInformation"] == null)
Response.Redirect(Request.ApplicationPath);

// Grab WO number if it exists
if (Request.Params["workOrder"] != null)
WorkOrder.Text = Request.Params["workOrder"].ToString();

// Get part information from session
part = (Business.PartInformation)Session["PartInformation"];

// Populate form fields with data from part info object in session
PopulateFields();
}



Here's the code from Form #1 that sets the session info:

// Load the part information and pass the object to the next form.
private void NextPage_Click(object sender, System.Web.UI.ImageClickEventArgs
e)
{
Business.PartInformation part = new
Business.PartInformation(PartNumber.Text);

// If PO is visible and something was selected then set PO number
if (PONumbers.SelectedItem != null)
{
if (PONumbers.SelectedItem.Text.Length > 0)
part.PoNumber = PONumbers.SelectedItem.Text;
}

// Loads the rest of the part information
part.Load();

// If part is "buy" then must choose PO
if (part.SourceCode.ToLower() == "b" && (PONumbers.SelectedItem == null ||
PONumbers.SelectedItem.Text.Length == 0))
{
Message.Text = "Part is bought so you must select a PO.";
DivMessage.Visible = true;
return;
}

// Store in session
Session["PartInformation"] = part;

// Redirect and pass WO number if it was supplied.
Response.Redirect(Request.ApplicationPath +
"/Modules/Defects/NewDefect2.aspx?workOrder=" + WONumber.Text);
}
 
J

Jim Hughes

Are Cookies enabled?

Session variables are referenced by a session id cookie.

Scott Wickham said:
I'm having a problem saving session information on one form and retrieving
it
on a subsequent form...for only one out of a number of users. Actually,
I'm
not absolutely certain it's a session problem but I'm hoping the experts
can
help me figure that out.

Our application uses a session variable to "pass" info from one form to
the
next. It has always worked fine for our users until a few weeks ago when
one
of our users started having a problem. Every time they would try to move
from
Form #1 (DefectEdit1.aspx) to Form #2 (DefectEdit2.aspx), they would get
redirected to the application's home page, which is what Form #2 is
supposed
to do whenever it doesn't find anything stored in the session variable
(Form
#1 is supposed to have saved the session variable right before redirecting
to
Form #2). So my assumption has been that there is a problem with the
session
information being saved.

The problem seems to be machine dependent. All the other users are having
no
problems with these forms on their own machines. The user in question does
not have a problem if he logs in on someone else's machine and uses the
application. Other users have the same problem if they go to this guy's
machine, even if they log in as themselves.

I figured there must be something in the Internet Options settings on his
machine that must be preventing him from saving session state. I made sure
that his IE Privacy settings were set to "Medium" (the default), which I
thought would allow most first-party cookies to be stored. I'm pretty sure
this is how the other users' machines are set up.
Didn't help. So we went to the Security tab and made sure that the
"Internet", "Local intranet", and "Trusted sites" zones were all set to
the
"Default" security level for each zone. Still didn't help. Finally, we
made
sure that the root web address for the application was added to the "Local
intranet" zone's list of sites on the Security tab, just to make sure that
the application was being forced into the default security settings for
"Local intranet". Still didn't help. The user is running XP Professional
and
we've downloaded all current Windows updates.

Any help would be greatly appreciated. We've tried everything we can think
of at this point.

Thanks,
Scott Wickham



Here's the code from Form #2 that checks the session info:

// Page load
private void Page_Load(object sender, System.EventArgs e)
{
// If user doesn't have permission to view this page then redirect
if (CheckPermissions() == false)
Response.Redirect(Request.ApplicationPath +
"/Modules/Workflow/WorkflowActionsPending.aspx?Module=ncr");

if (this.IsPostBack)
return;

// If there is no PartInformation object in session then we didn't arrive
here from DefectEdit1, so redirect.
//
// ******* This is where the redirection is occurring *******
//
if (Session["PartInformation"] == null)
Response.Redirect(Request.ApplicationPath);

// Grab WO number if it exists
if (Request.Params["workOrder"] != null)
WorkOrder.Text = Request.Params["workOrder"].ToString();

// Get part information from session
part = (Business.PartInformation)Session["PartInformation"];

// Populate form fields with data from part info object in session
PopulateFields();
}



Here's the code from Form #1 that sets the session info:

// Load the part information and pass the object to the next form.
private void NextPage_Click(object sender,
System.Web.UI.ImageClickEventArgs
e)
{
Business.PartInformation part = new
Business.PartInformation(PartNumber.Text);

// If PO is visible and something was selected then set PO number
if (PONumbers.SelectedItem != null)
{
if (PONumbers.SelectedItem.Text.Length > 0)
part.PoNumber = PONumbers.SelectedItem.Text;
}

// Loads the rest of the part information
part.Load();

// If part is "buy" then must choose PO
if (part.SourceCode.ToLower() == "b" && (PONumbers.SelectedItem == null ||
PONumbers.SelectedItem.Text.Length == 0))
{
Message.Text = "Part is bought so you must select a PO.";
DivMessage.Visible = true;
return;
}

// Store in session
Session["PartInformation"] = part;

// Redirect and pass WO number if it was supplied.
Response.Redirect(Request.ApplicationPath +
"/Modules/Defects/NewDefect2.aspx?workOrder=" + WONumber.Text);
}
 

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

Top