cant go to the root dirctory in ascx src

2019-08-09 16:39发布

问题:

I start to build DNN taskMagnager moduel and I need to use the controls in acsx page

C:\inetpub\wwwroot\dnndev\controls

the problem is that my project folder path is

C:\inetpub\wwwroot\dnndev\DesktopModules\TaskManager"

and when Im trying to go to path like this:

<%@ Register TagPrefix="dnn" TagName="label" **Src="~/controls/lablecontrol.ascx"** %> 

the src cant be found!

No matter what I do its always turns to

C:\inetpub\wwwroot\dnndev\DesktopModules\TaskManager\="~/controls/lablecontrol.ascx

I tried everything: tilde(~), /../..

Nothing works!

回答1:

It should be

<%@ Register TagPrefix="dnn" TagName="label" Src="~/controls/labelcontrol.ascx" %> 

I'm assuming that you're referring to an error within Visual Studio, right? Is there an actual error when you run the application?

One thing that you can do within Visual Studio to help it be less confused is to set the Root Application path in the project settings. Go to the Web tab in the project's settings, make sure you're setup to use IIS, and point the Project URL to the TaskManager folder (e.g. http://dnndev/DesktopModules/TaskManager), and then check the Override Application Root URL checkbox, and set it to the root of the site (e.g. http://dnndev). This will usually let Visual Studio figure out where the label control is correctly.

Also, it looks like you're using LableControl instead of LabelControl.