Failed to map the path System.Web.HttpException

Discussion in 'ASP .Net Web Controls' started by Adrian Tosca, Apr 20, 2005.

  1. Adrian Tosca

    Adrian Tosca Guest

    Hi All,

    I hope you can help me with this.
    I am getting a "Failed to map the path
    '/avionics/X_T_c101p02_k0opy2zv5r4ebl45jmdrr1mv_mainArea.ascx'"
    System.Web.HttpException when trying to execute the code below.

    string test = Server.MapPath("/avionics/" + mainAreaTemplate);
    where mainAreaTemplate contains
    '/avionics/X_T_c101p02_k0opy2zv5r4ebl45jmdrr1mv_mainArea.ascx'

    What is strange is that the exception appears at the 3'rd request. The
    first 2 requests the code execute ok (tested with breakpoints to be sure
    of this).

    I also tried with other paths and is the same situation (eg:
    Server.MapPath("ab/ab.txt"). It works a couple of times and then it
    crashes. It is strange that the number of working times is the same each
    time so it is not an random error.

    The only way it seems to work is within a page in the application root
    that makes Server.MapPath("ab.txt") - with no directory in the path.
    This is indeed even more strange.

    I am actually trying to make a LoadControl(path) and it seems that
    LoadControl execute internally a MapPath. From this I come to my
    example. So there is a problem with MapPath no with LoadControl.

    Note that there is no other thread that runs in the application or other
    similar thing (I read on forums that this can be an issue).

    You can find below the full exception stack.

    If you find any idea please help me
    Adrian


    Please find below the full exception stack:
    [HttpException (0x80004005): Failed to map the path
    '/avionics/X_T_c101p02_ug3uus45sog14c45qaholh55_mainArea.ascx'.]
    System.Web.Hosting.ISAPIWorkerRequest.MapPathSlowUsingIISCore(String
    path) +303
    System.Web.Hosting.ISAPIWorkerRequest.MapPath(String path) +419
    System.Web.HttpRequest.MapPath(String virtualPath, String
    baseVirtualDir, Boolean allowCrossAppMapping)
    System.Web.HttpRequest.MapPath(String virtualPath)
    System.Web.HttpServerUtility.MapPath(String path)
    Avionics.Web.CourseView.CoursePage.LoadDynamicControls() in
    d:\proiecte\avionics\solution\webui\courseview\engine\ui\default.aspx.cs:123
    Avionics.Web.CourseView.CoursePage.Course_PageChange(Object sender,
    PageEventArgs e) in
    d:\proiecte\avionics\solution\webui\courseview\engine\ui\default.aspx.cs:171
    Avionics.Business.PageChangeEventHandler.Invoke(Object sender,
    PageEventArgs e) +0
    Avionics.Business.Course.OnPageChange(PageEventArgs e) in
    D:\Proiecte\Avionics\Solution\BusinessFacade\Course.cs:45
    Avionics.Business.Course.InternalOnPageChange(PageEventArgs e) in
    D:\Proiecte\Avionics\Solution\BusinessFacade\Course.cs:208
    Avionics.Business.Course.Chapter_PageChange(Object sender,
    PageEventArgs e) in
    D:\Proiecte\Avionics\Solution\BusinessFacade\Course.cs:248
    Avionics.Business.Chapter.OnPageChange(PageEventArgs e) in
    D:\Proiecte\Avionics\Solution\BusinessFacade\Chapter.cs:68
    Avionics.Business.Chapter.InternalOnPageChange(PageEventArgs e) in
    D:\Proiecte\Avionics\Solution\BusinessFacade\Chapter.cs:62
    Avionics.Business.Chapter.set_PageIndex(Int32 value) in
    D:\Proiecte\Avionics\Solution\BusinessFacade\Chapter.cs:158
    Avionics.Business.Course.NextPage() in
    D:\Proiecte\Avionics\Solution\BusinessFacade\Course.cs:164

    Avionics.Web.CourseView.CoursePage.CoursePage_ChangeActivePage(Object
    sender, CommandEventArgs e) in
    d:\proiecte\avionics\solution\webui\courseview\engine\ui\default.aspx.cs:203

    Avionics.Web.Controls.Footer.OnNavigationBarItemClick(CommandEventArgs
    e) in d:\proiecte\avionics\solution\webui\footercontrol.ascx.cs:88
    Avionics.Web.Controls.Footer.InternalOnNavigationBarItemClick(Object
    sender, CommandEventArgs e) in
    d:\proiecte\avionics\solution\webui\footercontrol.ascx.cs:110
    Avionics.Web.Controls.Footer.navMenu_ItemCommand(Object source,
    DataListCommandEventArgs e) in
    d:\proiecte\avionics\solution\webui\footercontrol.ascx.cs:143

    System.Web.UI.WebControls.DataList.OnItemCommand(DataListCommandEventArgs e)
    System.Web.UI.WebControls.DataList.OnBubbleEvent(Object source,
    EventArgs e)
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
    System.Web.UI.WebControls.DataListItem.OnBubbleEvent(Object source,
    EventArgs e)
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
    System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e)

    System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    sourceControl, String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    System.Web.UI.Page.ProcessRequestMain()
     
    Adrian Tosca, Apr 20, 2005
    #1
    1. Advertising

  2. Adrian Tosca

    Adrian Tosca Guest

    Some more info:

    It seems that the problem appear only if the MapPath is executed on an
    event that originated from a user control. If the same code is executed
    elsewere (like for example on page pre render event) there is no
    exception rised.

    I used this info as a workaround (set a bool to true on the event and
    execute my code on pre render).

    Adrian
     
    Adrian Tosca, Apr 20, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    0
    Views:
    5,389
    Steve
    Jul 1, 2003
  2. Replies:
    0
    Views:
    2,279
  3. =?Utf-8?B?ZHBvbXQ=?=
    Replies:
    7
    Views:
    18,600
    uwking
    Apr 14, 2011
  4. J055
    Replies:
    2
    Views:
    710
  5. shil
    Replies:
    4
    Views:
    761
Loading...

Share This Page