Home All Groups Group Topic Archive Search About

Load User Control from different directory

Author
8 Jul 2005 3:08 PM
Robin Yarnell
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

Author
8 Jul 2005 4:04 PM
Michael Baltic
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


Show quoteHide quote
"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
>
>
Author
8 Jul 2005 5:33 PM
Robin Yarnell
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

Show quoteHide quote
"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
> >
> >
Author
8 Jul 2005 5:52 PM
Robin Yarnell
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

Show quoteHide quote
"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
> > >
> > >
Author
8 Jul 2005 6:58 PM
Robin Yarnell
This works now thanks for your help.

Robin

Show quoteHide quote
"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
> > > >
> > > >