473,725 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session variables disappear in relation to a file upload

Howdy
I've got a rather strange issue occuring.

I used forms based .NET authentication, although I'm also setting some
session variables when people login.

However, I've found when people use one of my webform pages which includes a
button that pops up a window where you can upload files, if you upload files
in this popup window, it seems to somehow clear out all of the session
variables and the users get logged out. However, if people don't upload
files, then their use of the webform page proceeds as required/expected.

I'm planning to phase out the session variables by upgrading my code,
however I can't understand this problem which seems quite strange and I'd
like to know what the problem is.

Any clues would be greatly appreciated.

Cheers
Matt
If it helps, here is code in question:
The main part of the code behind for the upload page:

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
if (!IsPostBack) {
pnlUpload.Visib le = true;
pnlUploaded.Vis ible = false;
}
if (IsPostBack) {
pnlUpload.Visib le = false;
pnlUploaded.Vis ible = true;
}
strJobRequestID = Request.QuerySt ring["JobRequest ID"];
btnClose2.Attri butes.Add("oncl ick", "return closeupdate();" );
}
public void UploadFile(obje ct Sender,EventArg s E) { //Event handler for
the upload button
lblFileList.Tex t = "";

if (Request.Files. Count > 0) { //if there are files attached

//Get directory path
string strDirPath = Server.MapPath( ".\\" + "/../../detail/files/" +
strJobRequestID + "/");
//Response.Write( strDirPath);

//if Directory path doesn't exist then create it
if (!Directory.Exi sts(strDirPath) ) {
Directory.Creat eDirectory(strD irPath);
}

//Iterate through the Request.Files collection
for(IntLoop=0; IntLoop<Request .Files.Count; IntLoop++) {
if (Request.Files[IntLoop] !=null) { //Checking for valid file
// Since the FileName gives the entire path we use Substring function
to get the filename (including the file extension).
string StrFileName =
Request.Files[IntLoop].FileName.Subst ring(Request.Fi les[IntLoop].FileName.LastI ndexOf("\\")
+ 1);
string StrFileType = Request.Files[IntLoop].ContentType;
int IntFileSize = Request.Files[IntLoop].ContentLength;

//Check for file length > 0 and Upload if it is
if (IntFileSize > 0) {
//Save the file to the web server
string filePath = (strDirPath + "/" + StrFileName);
Request.Files[IntLoop].SaveAs(filePat h);
lblFileList.Tex t += "<li>" + StrFileName + "</li>";
}
}
}

}

}

Here is the main code for the webform. Notice the "multipart/form-data" -
could that be causing the problem somehow?

<form id="JBSv4Server Form" enctype="multip art/form-data" runat="server">
<div class=JBSv4Popu pBody>
<!--begin of body-->
<div class=JBSv4Popu pMainBody>
<div class=JBSv4JobL isting><asp:pan el id=pnlUpload runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Attach files to job <%if
(!Request.Query String["JobRequest ID"].StartsWith("Te mp"))
{%><%=Request.Q ueryString["JobRequest ID"]%><% } %></h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td><input id="File1" type="file" size="30" name="File1"
runat="server"> </td>
<td class="listsTab leRight" valign="top" rowspan="5">
<p>Use the 'Browse' buttons to select up to five files, then click
'Upload
files'.</p>
<p>You'll be able to attach more files afterwards if you need
to.</p></td></tr>
<tr>
<td><input id="File2" type="file" size="30" name="File2"
runat="server"> </td></tr>
<tr>
<td><input id="File3" type="file" size="30" name="File3"
runat="server"> </td></tr>
<tr>
<td><input id="File4" type="file" size="30" name="File4"
runat="server"> </td></tr>
<tr>
<td><input id="File5" type="file" size="30" name="File5"
runat="server"> </td></tr>
<tr>
<td colspan="2"><in put class="formbutt on" onclick="closew indow();"
type="button" value="Close window" name="btnCloseW indow">&nbsp;
<asp:button id="CmdUpload" onclick="Upload File" runat="server"
cssclass="formb utton" text="Upload
files"></asp:button></td></tr></table></asp:panel><asp: panel
id=pnlUploaded runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Files attached</h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td>
<p>The following files have been attached:</p>
<ul>
<asp:label id="lblFileList " runat="server"> </asp:label></ul>
<p><strong>Plea se note: </strong>Use the 'Close Window' button below
when
you are finished which will close this window AND refresh the job
attachments list.</p>
<asp:button id="btnClose2" runat="server" cssclass="formb utton" text="Close
window"></asp:button>&nbs p;
<asp:button id="btnAttachMo re" runat="server" cssclass="formb utton"
text="Attach more files"></asp:button></td></tr></table></asp:panel></DIV>
<!--end of body--></DIV></DIV></FORM>
Dec 7 '05 #1
4 4485
Hi Matt,

Looks like your appdomain is recycling.

You may check that using Perfmon and application restrats counter to verify
if your appdomain is recycling.

Also, what is the size of the file which causes the issues? Is it each and
every file which causes the session to recycle??

--
Thanks,
Rahul Soni

--->The secret to creativity is knowing how to hide your sources<---

"Matt Jensen" wrote:
Howdy
I've got a rather strange issue occuring.

I used forms based .NET authentication, although I'm also setting some
session variables when people login.

However, I've found when people use one of my webform pages which includes a
button that pops up a window where you can upload files, if you upload files
in this popup window, it seems to somehow clear out all of the session
variables and the users get logged out. However, if people don't upload
files, then their use of the webform page proceeds as required/expected.

I'm planning to phase out the session variables by upgrading my code,
however I can't understand this problem which seems quite strange and I'd
like to know what the problem is.

Any clues would be greatly appreciated.

Cheers
Matt
If it helps, here is code in question:
The main part of the code behind for the upload page:

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
if (!IsPostBack) {
pnlUpload.Visib le = true;
pnlUploaded.Vis ible = false;
}
if (IsPostBack) {
pnlUpload.Visib le = false;
pnlUploaded.Vis ible = true;
}
strJobRequestID = Request.QuerySt ring["JobRequest ID"];
btnClose2.Attri butes.Add("oncl ick", "return closeupdate();" );
}
public void UploadFile(obje ct Sender,EventArg s E) { //Event handler for
the upload button
lblFileList.Tex t = "";

if (Request.Files. Count > 0) { //if there are files attached

//Get directory path
string strDirPath = Server.MapPath( ".\\" + "/../../detail/files/" +
strJobRequestID + "/");
//Response.Write( strDirPath);

//if Directory path doesn't exist then create it
if (!Directory.Exi sts(strDirPath) ) {
Directory.Creat eDirectory(strD irPath);
}

//Iterate through the Request.Files collection
for(IntLoop=0; IntLoop<Request .Files.Count; IntLoop++) {
if (Request.Files[IntLoop] !=null) { //Checking for valid file
// Since the FileName gives the entire path we use Substring function
to get the filename (including the file extension).
string StrFileName =
Request.Files[IntLoop].FileName.Subst ring(Request.Fi les[IntLoop].FileName.LastI ndexOf("\\")
+ 1);
string StrFileType = Request.Files[IntLoop].ContentType;
int IntFileSize = Request.Files[IntLoop].ContentLength;

//Check for file length > 0 and Upload if it is
if (IntFileSize > 0) {
//Save the file to the web server
string filePath = (strDirPath + "/" + StrFileName);
Request.Files[IntLoop].SaveAs(filePat h);
lblFileList.Tex t += "<li>" + StrFileName + "</li>";
}
}
}

}

}

Here is the main code for the webform. Notice the "multipart/form-data" -
could that be causing the problem somehow?

<form id="JBSv4Server Form" enctype="multip art/form-data" runat="server">
<div class=JBSv4Popu pBody>
<!--begin of body-->
<div class=JBSv4Popu pMainBody>
<div class=JBSv4JobL isting><asp:pan el id=pnlUpload runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Attach files to job <%if
(!Request.Query String["JobRequest ID"].StartsWith("Te mp"))
{%><%=Request.Q ueryString["JobRequest ID"]%><% } %></h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td><input id="File1" type="file" size="30" name="File1"
runat="server"> </td>
<td class="listsTab leRight" valign="top" rowspan="5">
<p>Use the 'Browse' buttons to select up to five files, then click
'Upload
files'.</p>
<p>You'll be able to attach more files afterwards if you need
to.</p></td></tr>
<tr>
<td><input id="File2" type="file" size="30" name="File2"
runat="server"> </td></tr>
<tr>
<td><input id="File3" type="file" size="30" name="File3"
runat="server"> </td></tr>
<tr>
<td><input id="File4" type="file" size="30" name="File4"
runat="server"> </td></tr>
<tr>
<td><input id="File5" type="file" size="30" name="File5"
runat="server"> </td></tr>
<tr>
<td colspan="2"><in put class="formbutt on" onclick="closew indow();"
type="button" value="Close window" name="btnCloseW indow">
<asp:button id="CmdUpload" onclick="Upload File" runat="server"
cssclass="formb utton" text="Upload
files"></asp:button></td></tr></table></asp:panel><asp: panel
id=pnlUploaded runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Files attached</h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td>
<p>The following files have been attached:</p>
<ul>
<asp:label id="lblFileList " runat="server"> </asp:label></ul>
<p><strong>Plea se note: </strong>Use the 'Close Window' button below
when
you are finished which will close this window AND refresh the job
attachments list.</p>
<asp:button id="btnClose2" runat="server" cssclass="formb utton" text="Close
window"></asp:button>
<asp:button id="btnAttachMo re" runat="server" cssclass="formb utton"
text="Attach more files"></asp:button></td></tr></table></asp:panel></DIV>
<!--end of body--></DIV></DIV></FORM>

Dec 7 '05 #2
Thanks Rahul

Hmm, application restarts are 807 and Requests Queued is 54,000!!!!

And the error occurred for 1 file of 1KB too.

Actually seems to be the code below that's causing the problem, which
renames the file upload directory from a temporary name to the ID number of
the job request (because the webform page in question is for logging a job,
and the directory path ID number is not known until the job is logged):

//JOB FILES (if they exist)

//Root directory path for JBS job files
string strDirPath = Server.MapPath( ".\\" + "/../../detail/files/");
//Response.Write( strDirPath+"<br >");

//New Directory path for logged job files
JBSv4.utils.jbs .v4.utils.utils utilsClass1 = new
JBSv4.utils.jbs .v4.utils.utils ();

strLongJobReque stID = utilsClass1.Lon gJobNumber(intJ obRequestID);
string strDirPathJobNo = strDirPath + strLongJobReque stID + "\\";
//Response.Write( strDirPathJobNo +"<br>");

//Directory path used for temporary file storage before JobRequestID
was created
strTempJobReque stID = tbxTempID.Text;
string strDirPathTemp = strDirPath + strTempJobReque stID + "\\";
//Response.Write( strDirPathTemp+ "<br>");

//Rename temporary file storage directory (if it exists) to job number
directory
if (Directory.Exis ts(strDirPathTe mp)) {
Directory.Move( strDirPathTemp, strDirPathJobNo );
}

What do I do?

Thanks again for any more help.
Matt
"Rahul Soni" <Ra*******@disc ussions.microso ft.com> wrote in message
news:1E******** *************** ***********@mic rosoft.com...
Hi Matt,

Looks like your appdomain is recycling.

You may check that using Perfmon and application restrats counter to
verify
if your appdomain is recycling.

Also, what is the size of the file which causes the issues? Is it each and
every file which causes the session to recycle??

--
Thanks,
Rahul Soni

--->The secret to creativity is knowing how to hide your sources<---

"Matt Jensen" wrote:
Howdy
I've got a rather strange issue occuring.

I used forms based .NET authentication, although I'm also setting some
session variables when people login.

However, I've found when people use one of my webform pages which
includes a
button that pops up a window where you can upload files, if you upload
files
in this popup window, it seems to somehow clear out all of the session
variables and the users get logged out. However, if people don't upload
files, then their use of the webform page proceeds as required/expected.

I'm planning to phase out the session variables by upgrading my code,
however I can't understand this problem which seems quite strange and I'd
like to know what the problem is.

Any clues would be greatly appreciated.

Cheers
Matt
If it helps, here is code in question:
The main part of the code behind for the upload page:

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
if (!IsPostBack) {
pnlUpload.Visib le = true;
pnlUploaded.Vis ible = false;
}
if (IsPostBack) {
pnlUpload.Visib le = false;
pnlUploaded.Vis ible = true;
}
strJobRequestID = Request.QuerySt ring["JobRequest ID"];
btnClose2.Attri butes.Add("oncl ick", "return closeupdate();" );
}
public void UploadFile(obje ct Sender,EventArg s E) { //Event handler for
the upload button
lblFileList.Tex t = "";

if (Request.Files. Count > 0) { //if there are files attached

//Get directory path
string strDirPath = Server.MapPath( ".\\" + "/../../detail/files/" +
strJobRequestID + "/");
//Response.Write( strDirPath);

//if Directory path doesn't exist then create it
if (!Directory.Exi sts(strDirPath) ) {
Directory.Creat eDirectory(strD irPath);
}

//Iterate through the Request.Files collection
for(IntLoop=0; IntLoop<Request .Files.Count; IntLoop++) {
if (Request.Files[IntLoop] !=null) { //Checking for valid file
// Since the FileName gives the entire path we use Substring
function
to get the filename (including the file extension).
string StrFileName =
Request.Files[IntLoop].FileName.Subst ring(Request.Fi les[IntLoop].FileName.LastI ndexOf("\\")
+ 1);
string StrFileType = Request.Files[IntLoop].ContentType;
int IntFileSize = Request.Files[IntLoop].ContentLength;

//Check for file length > 0 and Upload if it is
if (IntFileSize > 0) {
//Save the file to the web server
string filePath = (strDirPath + "/" + StrFileName);
Request.Files[IntLoop].SaveAs(filePat h);
lblFileList.Tex t += "<li>" + StrFileName + "</li>";
}
}
}

}

}

Here is the main code for the webform. Notice the "multipart/form-data" -
could that be causing the problem somehow?

<form id="JBSv4Server Form" enctype="multip art/form-data" runat="server">
<div class=JBSv4Popu pBody>
<!--begin of body-->
<div class=JBSv4Popu pMainBody>
<div class=JBSv4JobL isting><asp:pan el id=pnlUpload runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Attach files to job <%if
(!Request.Query String["JobRequest ID"].StartsWith("Te mp"))
{%><%=Request.Q ueryString["JobRequest ID"]%><% } %></h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td><input id="File1" type="file" size="30" name="File1"
runat="server"> </td>
<td class="listsTab leRight" valign="top" rowspan="5">
<p>Use the 'Browse' buttons to select up to five files, then click
'Upload
files'.</p>
<p>You'll be able to attach more files afterwards if you need
to.</p></td></tr>
<tr>
<td><input id="File2" type="file" size="30" name="File2"
runat="server"> </td></tr>
<tr>
<td><input id="File3" type="file" size="30" name="File3"
runat="server"> </td></tr>
<tr>
<td><input id="File4" type="file" size="30" name="File4"
runat="server"> </td></tr>
<tr>
<td><input id="File5" type="file" size="30" name="File5"
runat="server"> </td></tr>
<tr>
<td colspan="2"><in put class="formbutt on" onclick="closew indow();"
type="button" value="Close window" name="btnCloseW indow">
<asp:button id="CmdUpload" onclick="Upload File" runat="server"
cssclass="formb utton" text="Upload
files"></asp:button></td></tr></table></asp:panel><asp: panel
id=pnlUploaded runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Files attached</h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td>
<p>The following files have been attached:</p>
<ul>
<asp:label id="lblFileList " runat="server"> </asp:label></ul>
<p><strong>Plea se note: </strong>Use the 'Close Window' button
below
when
you are finished which will close this window AND refresh the job
attachments list.</p>
<asp:button id="btnClose2" runat="server" cssclass="formb utton"
text="Close
window"></asp:button>
<asp:button id="btnAttachMo re" runat="server" cssclass="formb utton"
text="Attach more
files"></asp:button></td></tr></table></asp:panel></DIV>
<!--end of body--></DIV></DIV></FORM>

Dec 7 '05 #3
On further investigation, it is this code

if (Directory.Exis ts(strDirPathTe mp)) {
Directory.Move( strDirPathTemp, strDirPathJobNo );
}

causing the problem, and I note that when this code runs (and the user gets
logged out), the counter for application restarts increases by 1.

I'm reading something that makes me think that maybe some virus checking
software is involved in the problem.

Thoughts?
Cheers
Matt

"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:uB******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks Rahul

Hmm, application restarts are 807 and Requests Queued is 54,000!!!!

And the error occurred for 1 file of 1KB too.

Actually seems to be the code below that's causing the problem, which
renames the file upload directory from a temporary name to the ID number
of the job request (because the webform page in question is for logging a
job, and the directory path ID number is not known until the job is
logged):

//JOB FILES (if they exist)

//Root directory path for JBS job files
string strDirPath = Server.MapPath( ".\\" + "/../../detail/files/");
//Response.Write( strDirPath+"<br >");

//New Directory path for logged job files
JBSv4.utils.jbs .v4.utils.utils utilsClass1 = new
JBSv4.utils.jbs .v4.utils.utils ();

strLongJobReque stID = utilsClass1.Lon gJobNumber(intJ obRequestID);
string strDirPathJobNo = strDirPath + strLongJobReque stID + "\\";
//Response.Write( strDirPathJobNo +"<br>");

//Directory path used for temporary file storage before JobRequestID
was created
strTempJobReque stID = tbxTempID.Text;
string strDirPathTemp = strDirPath + strTempJobReque stID + "\\";
//Response.Write( strDirPathTemp+ "<br>");

//Rename temporary file storage directory (if it exists) to job number
directory
if (Directory.Exis ts(strDirPathTe mp)) {
Directory.Move( strDirPathTemp, strDirPathJobNo );
}

What do I do?

Thanks again for any more help.
Matt
"Rahul Soni" <Ra*******@disc ussions.microso ft.com> wrote in message
news:1E******** *************** ***********@mic rosoft.com...
Hi Matt,

Looks like your appdomain is recycling.

You may check that using Perfmon and application restrats counter to
verify
if your appdomain is recycling.

Also, what is the size of the file which causes the issues? Is it each
and
every file which causes the session to recycle??

--
Thanks,
Rahul Soni

--->The secret to creativity is knowing how to hide your sources<---

"Matt Jensen" wrote:
Howdy
I've got a rather strange issue occuring.

I used forms based .NET authentication, although I'm also setting some
session variables when people login.

However, I've found when people use one of my webform pages which
includes a
button that pops up a window where you can upload files, if you upload
files
in this popup window, it seems to somehow clear out all of the session
variables and the users get logged out. However, if people don't upload
files, then their use of the webform page proceeds as required/expected.

I'm planning to phase out the session variables by upgrading my code,
however I can't understand this problem which seems quite strange and
I'd
like to know what the problem is.

Any clues would be greatly appreciated.

Cheers
Matt
If it helps, here is code in question:
The main part of the code behind for the upload page:

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
if (!IsPostBack) {
pnlUpload.Visib le = true;
pnlUploaded.Vis ible = false;
}
if (IsPostBack) {
pnlUpload.Visib le = false;
pnlUploaded.Vis ible = true;
}
strJobRequestID = Request.QuerySt ring["JobRequest ID"];
btnClose2.Attri butes.Add("oncl ick", "return closeupdate();" );
}
public void UploadFile(obje ct Sender,EventArg s E) { //Event handler
for
the upload button
lblFileList.Tex t = "";

if (Request.Files. Count > 0) { //if there are files attached

//Get directory path
string strDirPath = Server.MapPath( ".\\" + "/../../detail/files/" +
strJobRequestID + "/");
//Response.Write( strDirPath);

//if Directory path doesn't exist then create it
if (!Directory.Exi sts(strDirPath) ) {
Directory.Creat eDirectory(strD irPath);
}

//Iterate through the Request.Files collection
for(IntLoop=0; IntLoop<Request .Files.Count; IntLoop++) {
if (Request.Files[IntLoop] !=null) { //Checking for valid file
// Since the FileName gives the entire path we use Substring
function
to get the filename (including the file extension).
string StrFileName =
Request.Files[IntLoop].FileName.Subst ring(Request.Fi les[IntLoop].FileName.LastI ndexOf("\\")
+ 1);
string StrFileType = Request.Files[IntLoop].ContentType;
int IntFileSize = Request.Files[IntLoop].ContentLength;

//Check for file length > 0 and Upload if it is
if (IntFileSize > 0) {
//Save the file to the web server
string filePath = (strDirPath + "/" + StrFileName);
Request.Files[IntLoop].SaveAs(filePat h);
lblFileList.Tex t += "<li>" + StrFileName + "</li>";
}
}
}

}

}

Here is the main code for the webform. Notice the
"multipart/form-data" -
could that be causing the problem somehow?

<form id="JBSv4Server Form" enctype="multip art/form-data" runat="server">
<div class=JBSv4Popu pBody>
<!--begin of body-->
<div class=JBSv4Popu pMainBody>
<div class=JBSv4JobL isting><asp:pan el id=pnlUpload runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Attach files to job <%if
(!Request.Query String["JobRequest ID"].StartsWith("Te mp"))
{%><%=Request.Q ueryString["JobRequest ID"]%><% } %></h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td><input id="File1" type="file" size="30" name="File1"
runat="server"> </td>
<td class="listsTab leRight" valign="top" rowspan="5">
<p>Use the 'Browse' buttons to select up to five files, then click
'Upload
files'.</p>
<p>You'll be able to attach more files afterwards if you need
to.</p></td></tr>
<tr>
<td><input id="File2" type="file" size="30" name="File2"
runat="server"> </td></tr>
<tr>
<td><input id="File3" type="file" size="30" name="File3"
runat="server"> </td></tr>
<tr>
<td><input id="File4" type="file" size="30" name="File4"
runat="server"> </td></tr>
<tr>
<td><input id="File5" type="file" size="30" name="File5"
runat="server"> </td></tr>
<tr>
<td colspan="2"><in put class="formbutt on" onclick="closew indow();"
type="button" value="Close window" name="btnCloseW indow">
<asp:button id="CmdUpload" onclick="Upload File" runat="server"
cssclass="formb utton" text="Upload
files"></asp:button></td></tr></table></asp:panel><asp: panel
id=pnlUploaded runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Files attached</h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td>
<p>The following files have been attached:</p>
<ul>
<asp:label id="lblFileList " runat="server"> </asp:label></ul>
<p><strong>Plea se note: </strong>Use the 'Close Window' button
below
when
you are finished which will close this window AND refresh the job
attachments list.</p>
<asp:button id="btnClose2" runat="server" cssclass="formb utton"
text="Close
window"></asp:button>
<asp:button id="btnAttachMo re" runat="server" cssclass="formb utton"
text="Attach more
files"></asp:button></td></tr></table></asp:panel></DIV>
<!--end of body--></DIV></DIV></FORM>


Dec 7 '05 #4
This appears to be by 'design'...!!
http://groups.google.co.uk/group/mic...f03aac74f80ba6

Solved using the code on this page:
http://blogs.msdn.com/korbyp/archive.../19/76411.aspx

Still wondering though what it means that my Requests Queued is 54,000!?

Thanks for any advice
Cheers
Matt

"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:%2******** **********@TK2M SFTNGP15.phx.gb l...
On further investigation, it is this code

if (Directory.Exis ts(strDirPathTe mp)) {
Directory.Move( strDirPathTemp, strDirPathJobNo );
}

causing the problem, and I note that when this code runs (and the user
gets logged out), the counter for application restarts increases by 1.

I'm reading something that makes me think that maybe some virus checking
software is involved in the problem.

Thoughts?
Cheers
Matt

"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:uB******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks Rahul

Hmm, application restarts are 807 and Requests Queued is 54,000!!!!

And the error occurred for 1 file of 1KB too.

Actually seems to be the code below that's causing the problem, which
renames the file upload directory from a temporary name to the ID number
of the job request (because the webform page in question is for logging a
job, and the directory path ID number is not known until the job is
logged):

//JOB FILES (if they exist)

//Root directory path for JBS job files
string strDirPath = Server.MapPath( ".\\" + "/../../detail/files/");
//Response.Write( strDirPath+"<br >");

//New Directory path for logged job files
JBSv4.utils.jbs .v4.utils.utils utilsClass1 = new
JBSv4.utils.jbs .v4.utils.utils ();

strLongJobReque stID = utilsClass1.Lon gJobNumber(intJ obRequestID);
string strDirPathJobNo = strDirPath + strLongJobReque stID + "\\";
//Response.Write( strDirPathJobNo +"<br>");

//Directory path used for temporary file storage before JobRequestID
was created
strTempJobReque stID = tbxTempID.Text;
string strDirPathTemp = strDirPath + strTempJobReque stID + "\\";
//Response.Write( strDirPathTemp+ "<br>");

//Rename temporary file storage directory (if it exists) to job
number directory
if (Directory.Exis ts(strDirPathTe mp)) {
Directory.Move( strDirPathTemp, strDirPathJobNo );
}

What do I do?

Thanks again for any more help.
Matt
"Rahul Soni" <Ra*******@disc ussions.microso ft.com> wrote in message
news:1E******** *************** ***********@mic rosoft.com...
Hi Matt,

Looks like your appdomain is recycling.

You may check that using Perfmon and application restrats counter to
verify
if your appdomain is recycling.

Also, what is the size of the file which causes the issues? Is it each
and
every file which causes the session to recycle??

--
Thanks,
Rahul Soni

--->The secret to creativity is knowing how to hide your sources<---

"Matt Jensen" wrote:

Howdy
I've got a rather strange issue occuring.

I used forms based .NET authentication, although I'm also setting some
session variables when people login.

However, I've found when people use one of my webform pages which
includes a
button that pops up a window where you can upload files, if you upload
files
in this popup window, it seems to somehow clear out all of the session
variables and the users get logged out. However, if people don't upload
files, then their use of the webform page proceeds as
required/expected.

I'm planning to phase out the session variables by upgrading my code,
however I can't understand this problem which seems quite strange and
I'd
like to know what the problem is.

Any clues would be greatly appreciated.

Cheers
Matt
If it helps, here is code in question:
The main part of the code behind for the upload page:

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
if (!IsPostBack) {
pnlUpload.Visib le = true;
pnlUploaded.Vis ible = false;
}
if (IsPostBack) {
pnlUpload.Visib le = false;
pnlUploaded.Vis ible = true;
}
strJobRequestID = Request.QuerySt ring["JobRequest ID"];
btnClose2.Attri butes.Add("oncl ick", "return closeupdate();" );
}
public void UploadFile(obje ct Sender,EventArg s E) { //Event handler
for
the upload button
lblFileList.Tex t = "";

if (Request.Files. Count > 0) { //if there are files attached

//Get directory path
string strDirPath = Server.MapPath( ".\\" + "/../../detail/files/" +
strJobRequestID + "/");
//Response.Write( strDirPath);

//if Directory path doesn't exist then create it
if (!Directory.Exi sts(strDirPath) ) {
Directory.Creat eDirectory(strD irPath);
}

//Iterate through the Request.Files collection
for(IntLoop=0; IntLoop<Request .Files.Count; IntLoop++) {
if (Request.Files[IntLoop] !=null) { //Checking for valid file
// Since the FileName gives the entire path we use Substring
function
to get the filename (including the file extension).
string StrFileName =
Request.Files[IntLoop].FileName.Subst ring(Request.Fi les[IntLoop].FileName.LastI ndexOf("\\")
+ 1);
string StrFileType = Request.Files[IntLoop].ContentType;
int IntFileSize = Request.Files[IntLoop].ContentLength;

//Check for file length > 0 and Upload if it is
if (IntFileSize > 0) {
//Save the file to the web server
string filePath = (strDirPath + "/" + StrFileName);
Request.Files[IntLoop].SaveAs(filePat h);
lblFileList.Tex t += "<li>" + StrFileName + "</li>";
}
}
}

}

}

Here is the main code for the webform. Notice the
"multipart/form-data" -
could that be causing the problem somehow?

<form id="JBSv4Server Form" enctype="multip art/form-data"
runat="server">
<div class=JBSv4Popu pBody>
<!--begin of body-->
<div class=JBSv4Popu pMainBody>
<div class=JBSv4JobL isting><asp:pan el id=pnlUpload runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Attach files to job <%if
(!Request.Query String["JobRequest ID"].StartsWith("Te mp"))
{%><%=Request.Q ueryString["JobRequest ID"]%><% } %></h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td><input id="File1" type="file" size="30" name="File1"
runat="server"> </td>
<td class="listsTab leRight" valign="top" rowspan="5">
<p>Use the 'Browse' buttons to select up to five files, then
click
'Upload
files'.</p>
<p>You'll be able to attach more files afterwards if you need
to.</p></td></tr>
<tr>
<td><input id="File2" type="file" size="30" name="File2"
runat="server"> </td></tr>
<tr>
<td><input id="File3" type="file" size="30" name="File3"
runat="server"> </td></tr>
<tr>
<td><input id="File4" type="file" size="30" name="File4"
runat="server"> </td></tr>
<tr>
<td><input id="File5" type="file" size="30" name="File5"
runat="server"> </td></tr>
<tr>
<td colspan="2"><in put class="formbutt on" onclick="closew indow();"
type="button" value="Close window" name="btnCloseW indow">
<asp:button id="CmdUpload" onclick="Upload File" runat="server"
cssclass="formb utton" text="Upload
files"></asp:button></td></tr></table></asp:panel><asp: panel
id=pnlUploaded runat="server">
<div class="JBSv4Job ListingHeader">
<h3>Files attached</h3></div>
<table class="JBSv4Job ListingTable">
<tr>
<td>
<p>The following files have been attached:</p>
<ul>
<asp:label id="lblFileList " runat="server"> </asp:label></ul>
<p><strong>Plea se note: </strong>Use the 'Close Window' button
below
when
you are finished which will close this window AND refresh the job
attachments list.</p>
<asp:button id="btnClose2" runat="server" cssclass="formb utton"
text="Close
window"></asp:button>
<asp:button id="btnAttachMo re" runat="server" cssclass="formb utton"
text="Attach more
files"></asp:button></td></tr></table></asp:panel></DIV>
<!--end of body--></DIV></DIV></FORM>



Dec 7 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6571
by: Ruben van Engelenburg | last post by:
Hi all, I have a strange problem. I have a login procedure that uses a mysql database in which the users are stored. The login procedure is pretty straightforward. In every page I unclude my session.php. session.php: =============
9
3644
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk for my session variable based security scheme. Basically, the risk is that a user will login to my site, close the window when done and allow someone else to come up to the machine, go back to my site and be logged into the previous user's...
9
2451
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example at http://www.lamartin.com/dotnet/sessiontestset.aspx, were I set Session, Application and Cache variables on the first page and then on the second page view them as the second page is refreshed every five seconds. Before 10 refreshes, the...
1
2100
by: Wiktor Zychla | last post by:
Hello there, I've just encountered a strange problem with Session. In one particular scenario it is cleared between pages but the scenario is so specific that I am really, really startled. I've tried to look for similar situations in the group archive and it seems that few people have observed similar behaviour. None of them, however, got a clear explanation that would correspond to my problem. In my web application I put some...
13
2856
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i visit again .... null ... again .... it works ..... again ... it works ... again ..... null....... and so on and on .... it does randomly work or not.... what is this effect?
4
1804
by: osh.sean | last post by:
I'm having a problem and I can't find anything about this anywhere else out there. I'm working on a solution that allows the end user to create folders / upload files to the web server. Some pertinent information is being stored in a session variable. If a user deletes the folder from the application, it clears any session variables as if deleting a folder made a call to Session.Abandon(). This also occurs if I delete the folder through...
5
3073
by: Simon | last post by:
Hi all, We have a small problem. We are running an ASP.NET1.1 application, using IIS6 on server2003, no web farm, on a single server, using in-proc session state, only using one worker process. The problem is that at seemingly random times, some of the session variables return as if set to nothing.
7
2044
by: mantrid | last post by:
I have some code to upload files to my site. it works when the <input type="file" is posted once even when I use session variables from the posted variables but when I carry those session variables to a new page the upload will not work. despite the variables being set. I have echoed then on the second page and they display correctly but they just dont work in the move_uploaded_file() function. I get the error message Error uploading...
11
11471
by: Dave | last post by:
I have a site with an App_Code folder that has Global.asax.cs and a file named Upload.cs. I want to pass Upload.cs a Session variable (username) that is set in default.aspx. Setting up a session variable in default.aspx is no problem, but how do I make it available to Upload.cs? I think it's a matter of writting code into the following two files: Global.asax.cs, and obviously, Upload.cs, but how exactly is it done?
0
8888
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
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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
9257
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
9174
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
9111
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...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.