Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends

i am getting error like
D:/Logdata3.xml' is a physical path, but a virtual path was expected.

my code is

VB
Sub loadXmlToGridview()
       Dim ds As New DataSet()
       Dim dataUrl As String = HttpContext.Current.Request.MapPath("D:\Logdata3.xml")
       ' Dim dataUrl As String = "~/App_Data/USA.xml"

       ds.ReadXml(Request.MapPath(dataUrl))
       Dim dv As DataView = New DataView(ds.Tables(0))
       dgvXmlPathSetting.DataSource = dv
       dgvXmlPathSetting.DataBind()
   End Sub


please help
Posted

1 solution

Don't you want the Server.MapPath

VB
Sub loadXmlToGridview()
       Dim ds As New DataSet()
       Dim dataUrl As String = HttpContext.Current.Server.MapPath(~/Logdata3.xml")
       ds.ReadXml(dataUrl)
       Dim dv As DataView = New DataView(ds.Tables(0))
       dgvXmlPathSetting.DataSource = dv
       dgvXmlPathSetting.DataBind()
End Sub
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900