Load User Control from different directory

Discussion in 'ASP .Net Web Controls' started by Robin Yarnell, Jul 8, 2005.

  1. Hello,
    I would like to create a user control, place it in a directory and use
    it for many different sites. The problem I am having is when I use the
    loadcontrol I get an error. The error states "The virtual path
    '/head/header.ascx' maps to another application, which is not allowed." This
    is because allowCrossAppMapping defaults to false in the HTTPRequest.MapPath
    that LoadControl uses. Is there a way that I can make the default for
    allowCrossAppMapping True instead of False? Or just set it in code each time
    I use it?

    Here is a bit of the stack trace:
    System.Web.HttpRequest.MapPath(String virtualPath, String baseVirtualDir,
    Boolean allowCrossAppMapping)
    System.Web.UI.BaseParser.MapPath(String path, Boolean allowCrossAppMapping)

    Any help on this would be appricated.

    Thanks in advance.

    Robin
     
    Robin Yarnell, Jul 8, 2005
    #1
    1. Advertising

  2. Create a virtual directory in your application which points to the controls
    directory.
    --
    Staff Consultant II
    Enterprise Web Services
    Cardinal Solutions Group

    Future Business Model
    Loan Origination Services
    National City Mortgage


    "Robin Yarnell" wrote:

    > Hello,
    > I would like to create a user control, place it in a directory and use
    > it for many different sites. The problem I am having is when I use the
    > loadcontrol I get an error. The error states "The virtual path
    > '/head/header.ascx' maps to another application, which is not allowed." This
    > is because allowCrossAppMapping defaults to false in the HTTPRequest.MapPath
    > that LoadControl uses. Is there a way that I can make the default for
    > allowCrossAppMapping True instead of False? Or just set it in code each time
    > I use it?
    >
    > Here is a bit of the stack trace:
    > System.Web.HttpRequest.MapPath(String virtualPath, String baseVirtualDir,
    > Boolean allowCrossAppMapping)
    > System.Web.UI.BaseParser.MapPath(String path, Boolean allowCrossAppMapping)
    >
    > Any help on this would be appricated.
    >
    > Thanks in advance.
    >
    > Robin
    >
    >
     
    Michael Baltic, Jul 8, 2005
    #2
    1. Advertising

  3. Thanks for the response.
    I tried that and I still get the same error "maps to another application,
    which is not allowed" any other ideas?

    Thanks,

    Robin

    "Michael Baltic" wrote:

    > Create a virtual directory in your application which points to the controls
    > directory.
    > --
    > Staff Consultant II
    > Enterprise Web Services
    > Cardinal Solutions Group
    >
    > Future Business Model
    > Loan Origination Services
    > National City Mortgage
    >
    >
    > "Robin Yarnell" wrote:
    >
    > > Hello,
    > > I would like to create a user control, place it in a directory and use
    > > it for many different sites. The problem I am having is when I use the
    > > loadcontrol I get an error. The error states "The virtual path
    > > '/head/header.ascx' maps to another application, which is not allowed." This
    > > is because allowCrossAppMapping defaults to false in the HTTPRequest.MapPath
    > > that LoadControl uses. Is there a way that I can make the default for
    > > allowCrossAppMapping True instead of False? Or just set it in code each time
    > > I use it?
    > >
    > > Here is a bit of the stack trace:
    > > System.Web.HttpRequest.MapPath(String virtualPath, String baseVirtualDir,
    > > Boolean allowCrossAppMapping)
    > > System.Web.UI.BaseParser.MapPath(String path, Boolean allowCrossAppMapping)
    > >
    > > Any help on this would be appricated.
    > >
    > > Thanks in advance.
    > >
    > > Robin
    > >
    > >
     
    Robin Yarnell, Jul 8, 2005
    #3
  4. Forget the last post. The virtual directory almost worked. Now I am getting
    an error during the parser phase which states:"It is an error to use a
    section registered as allowDefinition='MachineToApplication' beyond
    application level. This error can be caused by a virtual directory not being
    configured as an application in IIS." I looked at my IIS settings for the VD
    and everything seems to be set up right.

    Stack Trace also says:
    Line 37: by Microsoft that offers a single logon and core profile
    services for member sites.
    Line 38: -->
    Line 39: <authentication mode="Windows" />

    Does anyone know how to fix this?

    Thanks,

    Robin

    "Robin Yarnell" wrote:

    > Thanks for the response.
    > I tried that and I still get the same error "maps to another application,
    > which is not allowed" any other ideas?
    >
    > Thanks,
    >
    > Robin
    >
    > "Michael Baltic" wrote:
    >
    > > Create a virtual directory in your application which points to the controls
    > > directory.
    > > --
    > > Staff Consultant II
    > > Enterprise Web Services
    > > Cardinal Solutions Group
    > >
    > > Future Business Model
    > > Loan Origination Services
    > > National City Mortgage
    > >
    > >
    > > "Robin Yarnell" wrote:
    > >
    > > > Hello,
    > > > I would like to create a user control, place it in a directory and use
    > > > it for many different sites. The problem I am having is when I use the
    > > > loadcontrol I get an error. The error states "The virtual path
    > > > '/head/header.ascx' maps to another application, which is not allowed." This
    > > > is because allowCrossAppMapping defaults to false in the HTTPRequest.MapPath
    > > > that LoadControl uses. Is there a way that I can make the default for
    > > > allowCrossAppMapping True instead of False? Or just set it in code each time
    > > > I use it?
    > > >
    > > > Here is a bit of the stack trace:
    > > > System.Web.HttpRequest.MapPath(String virtualPath, String baseVirtualDir,
    > > > Boolean allowCrossAppMapping)
    > > > System.Web.UI.BaseParser.MapPath(String path, Boolean allowCrossAppMapping)
    > > >
    > > > Any help on this would be appricated.
    > > >
    > > > Thanks in advance.
    > > >
    > > > Robin
    > > >
    > > >
     
    Robin Yarnell, Jul 8, 2005
    #4
  5. This works now thanks for your help.

    Robin

    "Robin Yarnell" wrote:

    > Forget the last post. The virtual directory almost worked. Now I am getting
    > an error during the parser phase which states:"It is an error to use a
    > section registered as allowDefinition='MachineToApplication' beyond
    > application level. This error can be caused by a virtual directory not being
    > configured as an application in IIS." I looked at my IIS settings for the VD
    > and everything seems to be set up right.
    >
    > Stack Trace also says:
    > Line 37: by Microsoft that offers a single logon and core profile
    > services for member sites.
    > Line 38: -->
    > Line 39: <authentication mode="Windows" />
    >
    > Does anyone know how to fix this?
    >
    > Thanks,
    >
    > Robin
    >
    > "Robin Yarnell" wrote:
    >
    > > Thanks for the response.
    > > I tried that and I still get the same error "maps to another application,
    > > which is not allowed" any other ideas?
    > >
    > > Thanks,
    > >
    > > Robin
    > >
    > > "Michael Baltic" wrote:
    > >
    > > > Create a virtual directory in your application which points to the controls
    > > > directory.
    > > > --
    > > > Staff Consultant II
    > > > Enterprise Web Services
    > > > Cardinal Solutions Group
    > > >
    > > > Future Business Model
    > > > Loan Origination Services
    > > > National City Mortgage
    > > >
    > > >
    > > > "Robin Yarnell" wrote:
    > > >
    > > > > Hello,
    > > > > I would like to create a user control, place it in a directory and use
    > > > > it for many different sites. The problem I am having is when I use the
    > > > > loadcontrol I get an error. The error states "The virtual path
    > > > > '/head/header.ascx' maps to another application, which is not allowed." This
    > > > > is because allowCrossAppMapping defaults to false in the HTTPRequest.MapPath
    > > > > that LoadControl uses. Is there a way that I can make the default for
    > > > > allowCrossAppMapping True instead of False? Or just set it in code each time
    > > > > I use it?
    > > > >
    > > > > Here is a bit of the stack trace:
    > > > > System.Web.HttpRequest.MapPath(String virtualPath, String baseVirtualDir,
    > > > > Boolean allowCrossAppMapping)
    > > > > System.Web.UI.BaseParser.MapPath(String path, Boolean allowCrossAppMapping)
    > > > >
    > > > > Any help on this would be appricated.
    > > > >
    > > > > Thanks in advance.
    > > > >
    > > > > Robin
    > > > >
    > > > >
     
    Robin Yarnell, Jul 8, 2005
    #5
    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. Dotnetjunky
    Replies:
    0
    Views:
    398
    Dotnetjunky
    Aug 25, 2003
  2. Kevin Spencer
    Replies:
    0
    Views:
    437
    Kevin Spencer
    Aug 25, 2003
  3. moondaddy
    Replies:
    1
    Views:
    1,805
    moondaddy
    May 4, 2004
  4. Sehboo
    Replies:
    0
    Views:
    499
    Sehboo
    Nov 22, 2006
  5. Kit
    Replies:
    0
    Views:
    357
Loading...

Share This Page