Hi:
I'm trying to get this isolated storage snippet to work. It's trying to
write a few lines, then trying to read them and print them out to the
browser.
The browser prints the "Writing..." lines, and the "End of job" line, but no
"Reading" lines.
I've tried to debug it a bit, and the reader.Peek() value is -1 prior to the
first reader.ReadLine() attempt.
Anyone have any ideas? I'm on VS 2003 & .Net 1.1
Here's the code:
private void Page_Load(object sender, System.EventArgs e)
{
IsolatedStorageFileStream stream = new IsolatedStorageFileStream
("colors.txt",FileMode.Create,FileAccess.ReadWrite );
StreamWriter writer = new StreamWriter(stream);
string[] data = { "red", "orange", "yellow", "green", "blue", "indigo" };
for (int i=0; i<data.Length; i++)
{
writer.WriteLine(data[i]);
Response.Write("Writing: " + data[i] + "<br>");
}
stream.Seek(0,SeekOrigin.Begin);
StreamReader reader = new StreamReader(stream);
while (reader.Peek() > -1)
{
Response.Write("Reading: " + reader.ReadLine() + "<br/>");
}
reader.Close();
Response.Write("Normal eoj.");
} 2 1571
Hi Diana:
You'll want to make sure you close the writer stream before you start
trying to read - that should help.
Also - are you sure you want to use isolated storage on the sever?
It's generally more useful on the client side.
HTH,
--
Scott http://www.OdeToCode.com/blogs/scott/
On Mon, 02 May 2005 04:11:59 GMT, "Diana L" <di*****@mindspring.com>
wrote: Hi:
I'm trying to get this isolated storage snippet to work. It's trying to write a few lines, then trying to read them and print them out to the browser.
The browser prints the "Writing..." lines, and the "End of job" line, but no "Reading" lines.
I've tried to debug it a bit, and the reader.Peek() value is -1 prior to the first reader.ReadLine() attempt.
Anyone have any ideas? I'm on VS 2003 & .Net 1.1
Here's the code:
private void Page_Load(object sender, System.EventArgs e)
{
IsolatedStorageFileStream stream = new IsolatedStorageFileStream
("colors.txt",FileMode.Create,FileAccess.ReadWrit e);
StreamWriter writer = new StreamWriter(stream);
string[] data = { "red", "orange", "yellow", "green", "blue", "indigo" };
for (int i=0; i<data.Length; i++)
{
writer.WriteLine(data[i]);
Response.Write("Writing: " + data[i] + "<br>");
}
stream.Seek(0,SeekOrigin.Begin);
StreamReader reader = new StreamReader(stream);
while (reader.Peek() > -1)
{
Response.Write("Reading: " + reader.ReadLine() + "<br/>");
}
reader.Close();
Response.Write("Normal eoj.");
}
"Scott Allen" <sc***@nospam.odetocode.com> wrote You'll want to make sure you close the writer stream before you start trying to read - that should help.
Thanks, I closed the writer stream (which also closes the
IsolatedStorageStream), made a new instance of the isolated storage stream,
and it worked fine.
-- Diana This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jfixsen |
last post by:
Hello!
Oracle 9.2.0.4
SunOS pchi-db01 5.8 Generic_108528-19 sun4u sparc
SUNW,Ultra-EnterpriseSystem = SunOS
Node = pchi-db01
Release = 5.8
KernelID = Generic_108528-19
Machine = sun4u...
|
by: Arran Pearce |
last post by:
Hi,
I am writing a application and am trying to be good (security wise) and
use isolated storage instead of another location on the HDD.
My assembly recieves a MemoryStream object then writes...
|
by: Simon Chester |
last post by:
Hello! Can anyone help me with this problem?...
I have developed an ASP.NET (version 1.1) application which I have deployed
to a number of webservers.
The web application works fine on Windows...
|
by: George McLean |
last post by:
Hello,
I am trying to isolate some performance issues.
The database is DB2 v8.1 running on a Win2000 server with 4 processors and
1gb of RAM.
The application is a GIS application that uses...
|
by: Zdenek Drlik |
last post by:
Hi,
I have an ASP.NET application. I want to use IsolatedStorage in this
application. When I run this application with anonymous access set in
IIS (user set to IUSR_<machine>) and impersonation...
|
by: Josh Kandiko |
last post by:
Hi,
I've been having some frustrations with deleting files from the Isolated
Storage directories. Basically, I want my application to remove all
instances of configuration information for my...
|
by: Mike |
last post by:
Hi,
I am new to C and having problems with the following program.
Basically I am trying to read some files, loading data structures into
memory for latter searching.
I am trying to use structres...
|
by: SteveM |
last post by:
I am writing a ToolUsage tracker which we will be accessing from each
of our custom written tools. It will basically capture various pieces
of information about the user, and the application they...
|
by: mortovski |
last post by:
Hi there,
I'm working on a Windows application in C# and wanting to persist MDI window states so that when a user opens the application, it looks like it did when they closed it down.
I've been...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
| |