Need help with writing a file to a Network path (UPN)

  • Thread starter Thread starter pxpilot
  • Start date Start date
P

pxpilot

HELP!
I know there's a lot of urls out there, please don't reply with a
link.
I have tried them all but i guess i am missing something.

I have 2 servers on the same network, my ASP.NET runs on Server1 and
need to write RSS to a Server2
Something like this:
Dim enc As Encoding = Encoding.UTF8
Dim objXMLTW As New XmlTextWriter("\\Server2\wwwroot\SiteRoot
\rss.xml", enc)
objXMLTW.WriteStartDocument()
objXMLTW.WriteStartElement("rss")
objXMLTW.WriteElementString("Blah", "Blah Blah Blah")
objXMLTW.WriteEndDocument()
objXMLTW.Flush()
objXMLTW.Close()

I have tried:
* added <identity impersonate="true"/> to web.config (in Server1)
* added Full Control to Server1\ASPNET Server1\IUSR_Server1
Server1\IWAM_Server1
* created virtual directory on Server1 and tried both "Connect As"
options

I keep getting "Logon failure: unknown user name or bad password."

Ideas?
 
re:
!> * added <identity impersonate="true"/> to web.config (in Server1)

That's not enough.

You need to give write permissions to the account ASP.NET is running as,
so ASP.NET's impersonated account can write to Server2.

Generally, that is done by having ASP.NET impersonate
a domain account which has access to both servers.

<identity impersonate="true"
userName="domain\accountname"
password="somePassword" />

Mind you, after you do that you'll need to grant access permission
to a bunch of directories on Server1 to that account.

Here's the ACL list to the required directories :

http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx

You can shortcut by using this command line from the .Net 2.0 directory on Server1
*after* you configure the domain\accountname which ASP.NET will be impersonating,
in web.config:

aspnet_regiis -ga domain\accountname

Verify that the permissions have been applied
to the whole directory list after you issue the command.

Also, of course, you'll have to grant write permission to the network share on Server2
to the domain account ASP.NET is now impersonating, which will be accessing the
network share on Server2.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
Back
Top