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

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?
 
J

Juan T. Llibre

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top