Hi Huang,
Thanks for that. I've tried changing the user id and
password in the machine.config, to an account that
definitely has access to read and write to the mapped
drive, as I can use it no problem from windows explorer,
but I'm still having problems.
My code works fine when I write the file to a local
directory, but when I change to the mapped directory the
error I'm getting is:
[DirectoryNotFoundException: Could not find a part of the
path "Y:\Sreqimport\Websitesreq.xml".]
System.IO.__Error.WinIOError(Int32 errorCode, String
str) +287
System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize,
Boolean useAsync, String msgPath, Boolean bFromProxy) +859
System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share) +45
System.Xml.XmlTextWriter..ctor(String filename,
Encoding encoding)
System.Xml.XmlDOMTextWriter..ctor(String filename,
Encoding encoding)
System.Xml.XmlDocument.Save(String filename)
FlareCityCouncil.XMLAdapter.FlareEntity.Save() in
c:\inetpub\wwwroot\flare\flarecitycouncil\xmladapter\flaree
ntity.cs:91
FlareCityCouncil.ServiceRequests.SRAdd.Submit1_ServerClick
(Object sender, EventArgs e) in
c:\inetpub\wwwroot\flare\flarecitycouncil\servicerequests\s
radd.aspx.cs:93
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick
(EventArgs e)
System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IP
ostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
Any other thoughts?
Thanks ..
Helen
>-----Original Message-----
>Hi Helen,
>
>Thanks for your post. As I understand, your server with
IIS has a drive
>mapped to a different server. Now you want to write to a
file in the mapped
>drive in your ASP .NET application on the server. Please
correct me if
>there is any misunderstanding. I now share the following
information with
>you:
>
>1. As you know, the codebehind of .aspx page are server
side code that will
>be executed on your IIS server. As in this case, you can
use File class in
>.NET class library to access the file in the mapped
drive. Please refer to
>MSDN documentation on File class:
>
>File Class
>http://msdn.microsoft.com/library/default.asp
url=/library/en-us/cpref/html/
>frlrfSystemIOFileClassTopic.asp
>
>2. In addition, please make sure that your ASPNET account
have enough
>permissions to access the mapped folder and file. If not,
you can either
>set the folder's security properties manually or
impersonate another user
>account which has enough prevelidges in your ASP .NET Web
application.
>
>INFO: Implementing Impersonation in an ASP.NET Application
>http://support.microsoft.com/?id=306158
>
>Hope this helps.
>
>Regards,
>
>HuangTM
>Microsoft Online Partner Support
>MCSE/MCSD
>
>Get Secure! -- www.microsoft.com/security
>This posting is provided "as is" with no warranties and
confers no rights.
>
>.
>