473,394 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

StreamWriter.Write or WriteLine causes Session_End

If you use StreamWrite Write or WriteLine it causes Session to End!
e.g.
FileStream fs = File.Open(fileName,FileMode.Append,FileAccess.Writ e);
StreamWriter sw = new StreamWriter(fs);
sw.Write("test");
sw.Close();
fs.Close();

Now all session information is lost!!
Is there a work around for this ?
Nov 18 '05 #1
5 1870
"xuxu" <re*****@excite.com> wrote in message
news:5d**************************@posting.google.c om...
If you use StreamWrite Write or WriteLine it causes Session to End!
e.g.
FileStream fs = File.Open(fileName,FileMode.Append,FileAccess.Writ e);
StreamWriter sw = new StreamWriter(fs);
sw.Write("test");
sw.Close();
fs.Close();

Now all session information is lost!!
Is there a work around for this ?


I bet your code is throwing an exception which you're not catching. Put a
try-catch block around it and find out.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
"John Saunders" <jo**************@notcoldmail.com> wrote in message news:<#M**************@TK2MSFTNGP11.phx.gbl>...
"xuxu" <re*****@excite.com> wrote in message
news:5d**************************@posting.google.c om...
If you use StreamWrite Write or WriteLine it causes Session to End!
e.g.
FileStream fs = File.Open(fileName,FileMode.Append,FileAccess.Writ e);
StreamWriter sw = new StreamWriter(fs);
sw.Write("test");
sw.Close();
fs.Close();

Now all session information is lost!!
Is there a work around for this ?


I bet your code is throwing an exception which you're not catching. Put a
try-catch block around it and find out.


No the code is NOT throwing an exception all it does is write to a
file. Even
if it did throw an exception and it was unhandled it should NOT cause
a Session End event thus COMPLETELY wiping out all the user's info
saved in the Session. Other people are also having this problem but
they've posted in Italian and Dutch so I can't communicate with them,
here are there posts.

Subject: StreamWriter BUG ??
URL: http://groups.google.com/groups?q=St...GI27996&rnum=2

Subject: [ASP.NET] Session End?
URL: http://groups.google.com/groups?q=St...2net.dk&rnum=3
Nov 18 '05 #3
Did you attempt to place a try block around the code? If so, what was the
result?

--
John Saunders
johnwsaundersiii at hotmail
"xuxu" <re*****@excite.com> wrote in message
news:5d*************************@posting.google.co m...
"John Saunders" <jo**************@notcoldmail.com> wrote in message news:<#M**************@TK2MSFTNGP11.phx.gbl>...
"xuxu" <re*****@excite.com> wrote in message
news:5d**************************@posting.google.c om...
If you use StreamWrite Write or WriteLine it causes Session to End!
e.g.
FileStream fs = File.Open(fileName,FileMode.Append,FileAccess.Writ e); StreamWriter sw = new StreamWriter(fs);
sw.Write("test");
sw.Close();
fs.Close();

Now all session information is lost!!
Is there a work around for this ?


I bet your code is throwing an exception which you're not catching. Put a try-catch block around it and find out.


No the code is NOT throwing an exception all it does is write to a
file. Even
if it did throw an exception and it was unhandled it should NOT cause
a Session End event thus COMPLETELY wiping out all the user's info
saved in the Session. Other people are also having this problem but
they've posted in Italian and Dutch so I can't communicate with them,
here are there posts.

Subject: StreamWriter BUG ??
URL:

http://groups.google.com/groups?q=St...GI27996&rnum=2
Subject: [ASP.NET] Session End?
URL:

http://groups.google.com/groups?q=St...2net.dk&rnum=3
Nov 18 '05 #4
The issue was the security setting of the directory being written to.
Once the security was reset the problem went away.
But there was NO exception thrown!!
Thank you for you're help.
Nov 18 '05 #5

I suppose you have solved your problem by changing some settings. I have
also came across the same problem and want to solve it.

Please mention the exact steps you have taken to solve this problem.

I also tried playing with the security settings on the respective
directory but it didn;t help me at all. I gave full control to the
aspnet user over that directory and it didn;t work.

please advice.

thanks, Ramendra
--
Ramendra
------------------------------------------------------------------------
Ramendra's Profile: http://www.highdots.com/forums/m1757
View this thread: http://www.highdots.com/forums/t653240

Jan 17 '06 #6

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

Similar topics

4
by: Majed | last post by:
Hi , all I'm trying to write unicode to a file for another app (not developed with vs2003) to read it. I used StreamWriter with unicode encoding.but I was surprised that the streamwriter adds FFFE...
4
by: ASP Yaboh | last post by:
I am using StreamWriter's .Writeline() method to create a simple text file. I found that ASCII characters 255 & 254 are being inserted as the first two characters of the file which causes a...
9
by: ShadowOfTheBeast | last post by:
Hi, I have got a major headache understanding streamReader and streamWriter relationship. I know how to use the streamreader and streamwriter independently. but how do you write out using the...
12
by: Nina | last post by:
Hi there, What is the maximum length that one line can hold in a text file using StreamWriter's Write or WriteLine method? If the string is too long for one line to hold, what will Write or...
6
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error...
3
by: Mads Westen | last post by:
Hi, I'm making some changes to my program, because I need to write with Codepage 850. Before I used FileStream, but I found code to use with StreamWriter instead. My problem is, that I don't...
1
by: Max Powers | last post by:
Hello, I have a VB.NET code that creates a StreamWriter file first and then it does a series of procedures that write lines for this StreamWriter. When all the procedures are done, the...
1
by: paul.hine | last post by:
Hello, I maintain an application that pulls data from a web service and writes it to an Excel sheet. Originally, the app used OleDb to write the Excel. Exports ran fine except that some text...
4
by: Heron | last post by:
Hi, Could someone explain me why the following code doesn't work? The memorystream always remains with length 0. MemoryStream input = new MemoryStream();
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.