473,320 Members | 1,957 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,320 software developers and data experts.

C# - Application State lost when serializing object.

I've narrowed it down to what I think is the cause although I'm not too sure of a solution.

Here is my code:
Expand|Select|Wrap|Line Numbers
  1. public void WriteSaleListToFile(SaleList saleList, String filePath)
  2.         {
  3.             FileStream outFile;
  4.             BinaryFormatter bFormatter = new BinaryFormatter();
  5.  
  6.             // open file for output
  7.             outFile = new FileStream(filePath, FileMode.Create, FileAccess.Write);
  8.  
  9.             // output object to file via serialization
  10.             bFormatter.Serialize(outFile, saleList);
  11.  
  12.             // close file
  13.             outFile.Close();
  14.         }
I think it's causing the application to restart resulting in me losing state. How do I get around this for the sake of a uni project?
Apr 11 '13 #1
0 1070

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Tony G. | last post by:
Hi there, I have an APS 3 application, running on a Windows 2003 Web edition server - it is a very busy website, and when users are click on certain links (membership info), a new window i...
0
by: Brett | last post by:
I am working with vb.net in a asp.net application. I have created a config file in xml format. The goal is to be able to change the config file without having to recompile the entire...
3
by: Grinninger | last post by:
Hello, I am using ASP.NET, C# under W2K. I try to keep some important information in application- and session-state Objects. With the recycling of the ASPNet_WP.EXE my application- and...
4
by: BB | last post by:
Hello all, I might be missing something here, but am trying to understand the difference between using application-level variables--i.e. Application("MyVar")--and global variables--i.e. public...
2
by: Mel | last post by:
This may be a stupid question, but here goes... I have created a NameValueCollection in my website's application state. If, during a page request, I add a string key and string value to the...
8
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical...
2
by: Ivers | last post by:
My C# asp.net app (.NET 1.1) can generate an email whose body contains a link to the current page of the app. When the recipient of the email clicks the link (usually from Outlook), the app...
1
by: O.B. | last post by:
I have two classes, Logger and LoggerRuntime. Logger is serializble, LoggerRuntime is not. LoggerRuntime inherits from Logger. At runtime, I get a list of LoggerRuntime instances to save to an...
0
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL...
3
by: qwedster | last post by:
Hello! I tried to use Application State as given in MSDN (http://msdn.microsoft.com/en-us/library/ms178594.aspx): I opened a WebApplicaion (C#) in Visual Studio 2008 and added Global.asax file....
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.