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