Click here to Skip to main content
11,926,429 members (59,715 online)
Rate this:
Please Sign up or sign in to vote.
See more: IIS7 C# IIS RemoteControl
I have a web application in c#, creating a csv file in the directory "\\\\\\mps\\dialcodes.csv" and I used it just like the following :

System.IO.StreamWriter StreamWriter1 =
new System.IO.StreamWriter(@"\\\\\\mps\\dialcodes.csv", false, Encoding.Default);

The code works well when I run it from my localhost; but when I put my code on IIS server the following error appears :

Access to the path \\\mps\dialcodes.csv; is denied

I think the reason for that is related to user authorization. I used network service for my application pool.Besides, in the server in which my folder mps exits I do all af the security authorization. I give full control for network service in my mps folder.But nothing changed, the same error appears.
Posted 18-Mar-11 4:41am
Edited 20-Mar-11 8:06am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try putting the file into your web site's virtual directory somewhere.
Sandeep Mewara 18-Mar-11 13:41pm
Comment from OP:
You are rigt but, I have to put the file in the directory where my database exists becase after creating the file in that directory I will execute bulk insert function. If the file is not in the same directory with my database bulk insert function does not work!
shylsn 19-Mar-11 19:07pm
Unfortunatelly I have to put the file in remote content, but I do not how how to get authorization for read/write a emote file from IIS

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 20 Mar 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100