473,561 Members | 3,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Denied when trying to write to file via Web Service

Forgive me if this seems trivial but I cannot seem to find an answer. For
testing purposes, one of my methods in my Web Service writes to a file (at
least tries). I am using the following line of code to create the text file:

Dim sw As StreamWriter = New StreamWriter("c :\Accesstimes.t xt")

But the error i get back when trying to execute this line of code is the
following:

Access to the path "c:\Accesstimes .txt" is denied

I am at a loss as to why the web service can't create and write to a file on
the local drive. Can anyone point me in the right direction?

Many thanks...
--
Thanks,

Scott
Nov 12 '05 #1
3 13252


SQLScott wrote:
Forgive me if this seems trivial but I cannot seem to find an answer. For
testing purposes, one of my methods in my Web Service writes to a file (at
least tries). I am using the following line of code to create the text file:

Dim sw As StreamWriter = New StreamWriter("c :\Accesstimes.t xt")

But the error i get back when trying to execute this line of code is the
following:

Access to the path "c:\Accesstimes .txt" is denied

I am at a loss as to why the web service can't create and write to a file on
the local drive. Can anyone point me in the right direction?


Well the web service probably runs on IIS and then under a certain
account for which you need to grant write access to that directory.
See
http://support.microsoft.com/?kbid=812614
for IIS 6 account names
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2


SQLScott wrote:
Forgive me if this seems trivial but I cannot seem to find an answer. For
testing purposes, one of my methods in my Web Service writes to a file (at
least tries). I am using the following line of code to create the text file:

Dim sw As StreamWriter = New StreamWriter("c :\Accesstimes.t xt")

But the error i get back when trying to execute this line of code is the
following:

Access to the path "c:\Accesstimes .txt" is denied

I am at a loss as to why the web service can't create and write to a file on
the local drive. Can anyone point me in the right direction?


Also see this
http://www.aspfaq.com/show.asp?id=2039
for account settings.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #3
Thanks Martin,

while that wasn't exactly the answer, it certainly put me on the correct
path and I was able to solve the problem.

thanks for your help.

Scott

"Martin Honnen" wrote:


SQLScott wrote:
Forgive me if this seems trivial but I cannot seem to find an answer. For
testing purposes, one of my methods in my Web Service writes to a file (at
least tries). I am using the following line of code to create the text file:

Dim sw As StreamWriter = New StreamWriter("c :\Accesstimes.t xt")

But the error i get back when trying to execute this line of code is the
following:

Access to the path "c:\Accesstimes .txt" is denied

I am at a loss as to why the web service can't create and write to a file on
the local drive. Can anyone point me in the right direction?


Also see this
http://www.aspfaq.com/show.asp?id=2039
for account settings.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #4

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

Similar topics

5
6369
by: Sergey V | last post by:
Having following problem 1. Client: ASP application with anonymous access to be running as DOMAIN\my_user on WinXP 2. Server: DCOM NT Service runs on remote host (W2K Server) under the same account DOMAIN\my_user security within server is initialized using hr = CoInitializeSecurity(&appid, -1, NULL, NULL, 0, 0, 0, EOAC_APPID, NULL);
1
4083
by: Lyn Duong | last post by:
Hi, I have tried creating a linked server in microsoft sql 2000 to a db2 for vm database. I use a db2 v8 admin client, configure it via client configuration setup and then in Microsoft SQL Server 2000 enterprise manager, I create a linked server, I use ibm oledb driver for db2, datasource = mydatabase, product=my database, provider =...
1
5115
by: terrorix | last post by:
I want to save uploaded file to disk. I have this construction: HttpPostedFile myFile = ((HttpRequest)Request).Files; if (myFile != null) { string fn = "c:\\Inetpub\\wwwroot\\MyWeb\\upload\\File_1"; try { myFile.SaveAs(fn); lblMsg.Text = "File was uploaded and saved successfully!";
5
1151
by: José Joye | last post by:
Hello, I know the problem I'm having has been mentioned several time... However, the answers provided are not crystal clear. Here is my problem: I'm building a small web service that I will host on an internet Server provider site (eg: WebMatrixHosting) To be able to trace how it reacts, I want to write information in a log file. To do...
3
11746
by: JvCoach23 | last post by:
I'm trying to run a LoadAllImages(ds.Tables(0), "vcFileName", "d:\Image") Public Shared Sub LoadAllImages(ByVal MyDataTable As DataTable, ByVal FilePathField As String, ByVal ImageField As String) 'loop through all the rows and load the images For Each dr As DataRow In MyDataTable.Rows LoadImage(dr, ImageField, dr.Item(FilePathField))...
2
3070
by: Thomas Thomas | last post by:
Hi All, I am trying to access a mapped network drive folder. everything works fine normally. But when i run the application as service I am getting the error Traceback (most recent call last): File "docBoxApp.py", line 129, in ? File "core\PollFiles.pyc", line 332, in doPoll File "core\PollFiles.pyc", line 47, in createFileList File...
4
2038
by: jambalapamba | last post by:
hi all i am loading a html document in my iframe which comes from the same domain, when i am trying to acess the document(html page) in the iframe using java script i am getting access denied , but some times its not giving me error and i am able access the document. its inconsistent like some time it gives me error and sometimes...
4
2643
by: =?Utf-8?B?RUdPTg==?= | last post by:
nHi! We have a C# .NET application (exe) that is started by a service (like a watchdog) and the application is thereby runing as Local System account. On cetain computers (only a very few of thousands) it seems like the call InternetGetConnectedState gets FALSE back (even when there is a connection) and when i check GetLastError it says...
3
5033
by: wbabbit | last post by:
I am getting an "Access Denied" error when trying to access an executable in my web directory. I have tried cmd.exe, ftp.exe, even notepad.exe. I have given everyone, including the anonymous user, ASPNET user, and NETWORK SERVICE user full control of the entire directory, but am still getting the error. Access is denied. (Exception from...
0
7570
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...
0
7859
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. ...
0
8088
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...
1
7618
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...
0
7930
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...
0
5187
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...
0
3617
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...
0
3600
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
896
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...

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.