• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

using ascx in vs.net

hi

im trying to use an ascx file in my webform1 web page.  when i try to use it, it says

 The virtual path '/folder/file.ascx' maps to another application, which is not allowed

i used the following code to use the ascx file in my form

<%@ Register TagPrefix="aspz" TagName="MeControl" Src="../folder/file.ascx" %>

and then i use the control like this in the form

<aspz:MeControl id="mycontrolid" runat="server" />

i am using vs.net using a web project, so it has all the code behind stuff!

thanks
0
narmi2
Asked:
narmi2
  • 3
  • 2
  • 2
  • +3
5 Solutions
 
YZlatCommented:
you need to add your file.ascx to the current project in order to use it
0
 
tusharashahCommented:
If you are usging VS.Net then just Drag and Drop ASCX User control on your page and let VS.net take care of everything else..
0
 
raterusCommented:
Usercontrols can't be shared between two asp.net projects.  The error says it all, your usercontrol is in another application (as IIS sees it), you need to move it to the current application, and redo your links for it to work.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
tusharashahCommented:
Also, what YZlat said is the first thing to check up.. your UserControl must be in the Same Application. You cannot share UserControl between 2 different application.
0
 
narmi2Author Commented:
ok so i did what you said, i added the existing items from the other applicaiton into my current application, but i still get the same error!
0
 
laotzi2000Commented:
You should move the file physically to the directory under your current application directory,
or it will still be treated in another application.
0
 
tusharashahCommented:
Did you changed this?
<%@ Register TagPrefix="aspz" TagName="MeControl" Src="file.ascx" %>
0
 
YZlatCommented:
what is the error?
0
 
narmi2Author Commented:
the error is still  

"The virtual path '/folder/file.ascx' maps to another application, which is not allowed"

0
 
b1xml2Commented:
change it to "~/folder/file.ascx"
0
 
laotzi2000Commented:
You should copy the file.ascx file to the root directory under current application,
then you add it to your project.

The application boundary is physical direcotory, not project.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now