Problem with path to xml folder

Discussion in 'ASP.NET / ASP.NET Core' started by Kosmik, Mar 28, 2009.

  1. When you go to the following url you can see the error : http://www.djkosmik.com/vwguestbook.aspx

    He can't find the xml apparently. This is the code I used :

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    getGuestBookItems()

    End Sub

    Protected Sub getGuestBookItems()
    Dim myPagedData As New PagedDataSource
    Dim myMessages As New DataSet

    myMessages.ReadXml("e:\web\djkosmikcom\htdocs\Xml\myGuestbook.xml") myPagedData.DataSource = myMessages.Tables(0).DefaultView
    myPagedData.AllowPaging = False

    repViewGuestbook.DataSource = myPagedData
    repViewGuestbook.DataBind()

    End Sub

    Can anyone help my out on this one ?
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    Not sure if you copied the code directly but the following line seems to have a problem

    myMessages.ReadXml("e:\web\djkosmikcom\htdocs\Xml\ myGuestbook.xml") myPagedData.DataSource = myMessages.Tables(0).DefaultView


    Note there's a whitespace in front of the file name..
     
  3. I resolved the problem by using the MapPath function :)
     

Share This Page