HttpContext.Current.Server.MapPath

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krishnat
    New Member
    • Jun 2010
    • 1

    HttpContext.Current.Server.MapPath

    I have an xml configuration file in my project.

    when I am working in debug mode of .net IDE it is working fine, but when i tried to launch the project from IE, it is taking different path

    ex:
    below code works well in debug mode, but unable to launch in IE directly (http://localhost/WebProj/login.aspx)

    Pathtype A:
    Code:
     HttpContext.Current.Server.MapPath(@"\Configuration\xyz.xml");
    below code works well in IE and debug mode but having different problem.
    Pathtype B:
    Code:
     HttpContext.Current.Server.MapPath("") + @"\Configuration\xyz.xml";
    Problem: I have a folder MainPages under root folder of the project. under this I have AdminPages. These admin pages are not retrieving if I used pathtype B specified above and gives error no page available, but works fine when pathtype A specified above is used which runs in debug mode only but not able launch from IE.

    Help me please.
Working...