Is this a bug of ASP.Net 2.0 ? when I use relative paths in SqlXml class!

Is this a bug of ASP.Net 2.0 when I use relative paths in SqlXml class!

I can run Part 1 correctly in ASP.net 2.0, but when I run Part 1, I get the following error, why Is this a bug of ASP.Net 2.0

Could not find a part of the path 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\~\App_Data\InitializeBookmark.xml'.

 

//--------------Part 1------------------------
DatabaseBase myDatabaseBase = DatabaseHelper.GreateDatabaseOject();
SqlXml mySqlXml = new SqlXml(XmlReader.Create(@"E:\ASP.NET2.0_OnlineBookmark\onlinebookmark\App_Data\InitializeBookmark.xml"));
myDatabaseBase.InitializeAfterLogin(userID, mySqlXml);
//--------------Part 1------------------------


//--------------Part 2------------------------
DatabaseBase myDatabaseBase = DatabaseHelper.GreateDatabaseOject();
SqlXml mySqlXml = new SqlXml(XmlReader.Create("~/App_Data/InitializeBookmark.xml"));
myDatabaseBase.InitializeAfterLogin(userID, mySqlXml);
//--------------Part 2------------------------

 


 




Answer this question

Is this a bug of ASP.Net 2.0 ? when I use relative paths in SqlXml class!

  • Darren Whobrey

    Who could help me thanks!

  • Libelula

    ("~/App_Data/InitializeBookmark.xml"))
    If you're going to use the ~ you have to Server.MapPath it.

  • Is this a bug of ASP.Net 2.0 ? when I use relative paths in SqlXml class!