PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.

ASP.Net writing to files on a different server

 
 
Helen
Guest
Posts: n/a
 
      8th Dec 2003
How can I write a file to a mapped drive on a different
server, from an ASP.Net application?

Thanks

Helen
 
Reply With Quote
 
 
 
 
Tian Min Huang
Guest
Posts: n/a
 
      9th Dec 2003
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/de...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.

 
Reply With Quote
 
Helen
Guest
Posts: n/a
 
      9th Dec 2003
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.
>
>.
>

 
Reply With Quote
 
Tian Min Huang
Guest
Posts: n/a
 
      11th Dec 2003
Hello Helen,

Thanks for your response.

Based on my experience, you should also give the file share FullTrust
permission as described in the MSDN article below and check whether or the
problem still exists.

http://msdn.microsoft.com/library/de...us/vsintro7/ht
ml/vxurfprojectfoldernotsecuredialogbox.asp

I look forward to your result.

Have a nice day!

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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing data to SQL server Jim Microsoft Excel Programming 3 12th Dec 2005 09:57 PM
Writing to Web Server Glenn T. Kitchen Microsoft VB .NET 3 9th Apr 2005 01:29 PM
Writing a DNS server Peter Steele Microsoft Dot NET Framework 0 15th Jul 2004 05:36 PM
Writing a TCP server - Now understanding it:) Crirus Microsoft VB .NET 2 9th Nov 2003 11:41 AM
Writing to Server Admin Microsoft ASP .NET 1 6th Jul 2003 07:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:38 PM.