Load User Control from different directory

R

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
 
M

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
 
R

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
 
R

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
 
R

Robin Yarnell

This works now thanks for your help.

Robin

Robin Yarnell said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top