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

ATL Server and access to local drive


I have VC++ .NET 2003 ATL Server project. In one of its method I need to write some information in a local txt file. This txt file and this ATL Server are on the same ‘C: \’ drive. When I tried it I just get ERROR_ACCESS_DENIED error from GetLastError function. What do I need to modify to let this ATL Server to write on local hard drive? Is it file’s access permission or ATL Server security settings

Thanks a lot for hel



Nov 17 '05 #1
1 2325
Hello, Leonid

ATL Server applications run in the context specified in IIS configuration.
By default, the ATL Server application will impersonate the anonymous web
There are a few ways of working around this.

1) disable the anonymous access to the virtual directory where the ATL
Server application is installed. This way, IIS will require the credentials
of the remote user before launching teh request handling ( the ATL Server
code). Then, you can invoke AtlImpersonateClient from the ATL Server code to
impersonate the remote client. Now, if the remote client (the user that
launched the request) has permissions to write on your C drive, everything
will work smoothly

2) impersonate some local machine user which has permission to write in the
C drive in the ATL Server application for the code sequence that performs
the writing:
SetThreadToken(NULL, hToken); // start impersonation for current thread
// Write to disk

SetThreadToken(NULL, NULL) ;// end impersonation for current thread
hToken can be obtained by invoking LogonUser, details are available in MSDN
for both LogonUser and SetThreadToken
3) if your web application will be accessed by users that do not have
permissions on your C drive, you can leave the configuration intact and
create a folder on the C drive where the anonymous user (IUSR_<MACHINENAME>)
has permission to write. Use Explorer's security dialog to allow this user
to write in that folder
4) in the IIS configuration dialog for the virtual directory of the ATL
Server application, change the account used for anonymous access from
IUSR_<MACHINENAME> to some local user that has permissions to write in the
C: drive (or the folder on the C drive where you plan to write)

5) Change you application to write into a file in the virtual directory
itself and give Write permissions to that virtuall directory

6) Change the application's logic to use a database instead of file writing
Hope this helps,
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. It is for newsgroup
purposes only.


"Leonid" <an*******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...

I have VC++ .NET 2003 ATL Server project. In one of its method I need to write some information in a local txt file. This txt file and this ATL
Server are on the same 'C: \' drive. When I tried it I just get
ERROR_ACCESS_DENIED error from GetLastError function. What do I need to
modify to let this ATL Server to write on local hard drive? Is it file's
access permission or ATL Server security settings?
Thanks a lot for help



Nov 17 '05 #2

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

Similar topics

by: Helen | last post by:
How can I write a file to a mapped drive on a different server, from an ASP.Net application? Thanks Helen
by: Z0gS | last post by:
I got this problem for the web application I try to access files on a remote server. string dirs = Directory.GetDirectories(@"E:\vehicles") E drive is a map to a network drive. I get the...
by: Jon | last post by:
I'm calling Server.MapPath from global.asa through this line of code: Application("reports_dir") = Server.MapPath("Reports") The web application opens on a testing web server (not mine) at this...
by: Jan | last post by:
Hi: I have an Access database that's been running (in one form or another) for a couple of different clients for a few years. Now a new client has requested that it be implemented with a SQL...
by: partybob99 | last post by:
Hi everyone. I have a very strange problem and I have no idea how to correct it. I created a VB.NET DLL that is used by several different apps for password file encryption/decryption. I have...
by: elmer.piano | last post by:
We have a directory of files on our ftp server. Is there a javacript to make a connection to the ftp server and compare files on a local drive and on the server? Files that have been changed or...
by: M Cavanagh | last post by:
I am fairly new using functions to return file info and I made an assumption that a function working on a local machine would work fine on a server. I have searched several Access books to find a...
by: lesperancer | last post by:
I've got an access97 reporting mdb that pulls data (77,000 rows) from a sql server table into a local table to run reports if the local table is part of the reporting MDB, the insert statement...
by: Bill Nguyen | last post by:
One of my apps (running in a terminal server session) needs to access a local USB drive /fash card. Is there a way to access local drives programmatically? Thanks Bill
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...

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.