473,768 Members | 4,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help to solve error while reading a file?

Hi all,

I have made an ASP.NET 1.1 application on windows 2000 advanced server.
In the application, i have saved the file using the following code

string str;
str="this is my data";
FileStream fs=new FileStream("myt xt.txt",FileMod e.open);
StreamWriter sr=new StreamWriter (fs);
sr.Write(str);
Now i can write the file and even read it on my system. It saves the
file in my C:\WINNT\System 32. Now my C Drive is FAT32. Please note that
name of my application is "MyWebProje ct".

Now i copy my project folder i.e. "MyWebProje ct" from wwwrooot and take
to other system and saves the file in other system that is running Win
XP which has IIS installed. I have made a virtual directory that maps
to the file i just copied from Win 2000. Please also note that C Drive
of Win XP is NTFS.
Now when i try to run my application on Win XP, it throws an error
which is as following
--------------------------------------------------------------------------------------------------------------------
Access to the path "C:\WINDOWS\sys tem32\mytxt.txt " is denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
--------------------------------------------------------------------------------------------------------------------

Now please let me know what i am doing wrong here, if i have to set
some seucrity permissions within my XP machine then please let me know
how should i go about it?
OR if there is some other error then please let me know what it is....
I appreciate your time and thanks in advance.

-Erland

Apr 12 '06 #1
1 1452
Well, one thing you don't want to do is to grant your ASPNET account access
to your system32 folder. Move the file to the web application folder and you
don't have to do a thing to read it. If you have to write the file, include
the full path or use Server.MapPath to get the path to the file so that it
won't default to System32.

If you definitely want it out of the application folder, create a different
folder that is not in your Windows directory for your virtual folder and make
sure that ASPNET has write permissions to it.

HTH
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Erland" wrote:
Hi all,

I have made an ASP.NET 1.1 application on windows 2000 advanced server.
In the application, i have saved the file using the following code

string str;
str="this is my data";
FileStream fs=new FileStream("myt xt.txt",FileMod e.open);
StreamWriter sr=new StreamWriter (fs);
sr.Write(str);
Now i can write the file and even read it on my system. It saves the
file in my C:\WINNT\System 32. Now my C Drive is FAT32. Please note that
name of my application is "MyWebProje ct".

Now i copy my project folder i.e. "MyWebProje ct" from wwwrooot and take
to other system and saves the file in other system that is running Win
XP which has IIS installed. I have made a virtual directory that maps
to the file i just copied from Win 2000. Please also note that C Drive
of Win XP is NTFS.
Now when i try to run my application on Win XP, it throws an error
which is as following
--------------------------------------------------------------------------------------------------------------------
Access to the path "C:\WINDOWS\sys tem32\mytxt.txt " is denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
--------------------------------------------------------------------------------------------------------------------

Now please let me know what i am doing wrong here, if i have to set
some seucrity permissions within my XP machine then please let me know
how should i go about it?
OR if there is some other error then please let me know what it is....
I appreciate your time and thanks in advance.

-Erland

Apr 13 '06 #2

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

Similar topics

6
2514
by: wonder | last post by:
Hi, The CRM application said that need to add an option "REGISTER_GLOBALS=On" to the php.ini file, so I did what it told. But I still can't get rid off the following error: The PHP variable "REGISTER_GLOBALS" is disabled (0). This is fatal. Edit your php.ini and set REGISTER_GLOBALS to "On". I changed the value "On" to "Yes", still getting the same error.
1
1871
by: Ram | last post by:
Dear All I am very new to python . i would appreciate any help from you all on this problem which i am facing. I am trying to connect to postgres from python.for this i am using something like " import pgdb". i am able to connect to postgres and fetch data , if i execute the python file directly in unix prompt. However when i try to do thsi through broeser iam getting the following error.. Traceback (most recent call last):
1
3191
by: Hafeez | last post by:
I am having real trouble compiling this code http://www.cs.wisc.edu/~vganti/birchcode/codeHier/AttrProj.tgz The attachment shows errors when compiled using the current version of g++ in a i386-pc-solaris2.9. Seeing reference to gcc-2.7.2 in the Makefile of the code, I downloaded it and compiled in my home directory. Then changed the referenes of LIBDIR and INCLUDES to this installation .and ran with g++ for 2.7.2 then there are still...
6
4997
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
2
1125
by: Erland | last post by:
Hi all, I have made an ASP.NET 1.1 application on windows 2000 advanced server. In the application, i have saved the file using the following code string str; str="this is my data"; FileStream fs=new FileStream("mytxt.txt",FileMode.open);
1
2010
by: Nestor | last post by:
Hello all, I'm begining in the web services world and I've reading about how to invoke them using javascript from Mozilla browser (version 2.0 in my case). I found a very interesting example here: http://www.mozilla.org/projects/webservices/examples/babelfish-wsdl/index.html The problem I have is this: When I try to adapt the invokation on the
0
5573
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
1
1716
by: Sean128 | last post by:
Hi, I hope someone can help me - this seems like it should be a really simple problem but I've been having trouble trying to solve it all week. I have hosted my website on a Linux server in 1 and 1 that I can not modefiy the Apache server. They told me I need to create the .htaccess file. The code that I put in my Biocon folder in my .htaccess file is: php_value include_path "/bioconstore/lib:/plate-latest"
1
2481
by: Sean128 | last post by:
Hi, I hope someone can help me - this seems like it should be a really simple problem but I've been having trouble trying to solve it all week. I have hosted my website on a Linux server in 1 and 1 and I can not modefiy the Apache server. They told me I need to create the .htaccess file. The code that I put in my .htaccess file is: php_value include_path "/bioconstore/lib:/plate-latest"
0
9407
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
10171
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
10015
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
9960
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
6656
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();...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3931
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.