Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WriteXML to a different server

Status
Not open for further replies.

barrylowe

Programmer
Nov 6, 2001
188
GB
I have written the following piece of code which uses the WriteXML method to create an XML file:

Dim strSQL As String
strSQL = "SELECT * FROM ExternalJobs"

Dim dsInternetVacancies As New DataSet
Dim adptInternetVacancies As New SqlClient.SqlDataAdapter(strSQL, SqlConnection1)

adptInternetVacancies.Fill(dsInternetVacancies)

If dsInternetVacancies.Tables(0).Rows.Count > 0 Then

' Create an XML file based on the content of the dataset
Dim strFileName As String = ConfigurationSettings.AppSettings("strInternetXMLPath")

Dim f As New System.Security.Permissions.FileIOPermission(Security.Permissions.FileIOPermissionAccess.Write, strFileName)

dsInternetVacancies.WriteXml(strFileName, XmlWriteMode.IgnoreSchema)

End If


As you can see the code uses an AppSettings value to get the location for the file.

This code works perfectly well when I am working in my development envoronment where the AppSettings value is "D:\Development\ASP_NET.....\InternetVacancies.xml" i.e. it is on the D: drive of the machine that is running the web application.

However in the Live environment the file needs to be cretaed on another server than that which is running the application. The AppSettings value is set to "\\IntranetServer\VacanciesXML\InternetVacancies.xml".

When this code is run, a login prompt appears on the screen saying that it is trying to connect to the server that is running the application. I have tried logging in as myself (I have administrator rights) but it throws up the login 3 times then tell me that "Access to path \\IntranetServer\VacanciesXML\InternetVacancies.xml is denied"

I have set the Write permissions on the share to allow Eveerybody but still no luck.

Can anyone help?
 
You will have to set the permissions for the user that the web application is running under (e.g ASPNET, Network Service or an impersonated user).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I tried that and it made no difference.

The thing to take note of is that the login window seems to imply that it is trying to log on to the server that is running the application, not the one that it is trying to write to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top