473,659 Members | 2,934 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 13266


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
6375
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
4089
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 = db2oledb. When I try to access the database via an openquery to the linked server, I get an error from...
1
5136
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
1153
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 so, I want to use a tracelistener and write the information in a
3
11756
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)) Next
2
3077
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 "core\PollFiles.pyc", line 25, in addFolderFiles
4
2040
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 not(for the same document). Inside the html document its refering to the website images that are not in...
4
2649
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 5=Access denied, that InternetGetConnectedState got Access denied and thereby returns false (I...
3
5039
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 HRESULT: 0x80070005 (E_ACCESSDENIED)) Source Error:
0
8332
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
8746
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
8525
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
8627
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5649
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
4175
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...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
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
1737
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.