Load User Control from different directory

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?

Advertisements

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
>
>

Advertisements

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
> >
> >

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
> > >
> > >

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!