Click here to Skip to main content
11,813,974 members (46,630 online)
Rate this: bad
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 3:41am
Edited 20-Mar-11 7: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 at 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 at 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
0 Abhinav S 265
1 Maciej Los 203
2 Palash Mondal_ 190
3 Sergey Alexandrovich Kryukov 179
0 OriginalGriff 3,877
1 KrunalRohit 2,526
2 Maciej Los 2,245
3 CPallini 2,240
4 ppolymorphe 1,750

Advertise | Privacy | Mobile
Web01 | 2.8.151002.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