Last post Feb 11, 2009 05:14 AM by Anubis09
Feb 06, 2009 07:12 AM|Anubis09|LINK
I've recently written a custom validator for a web site I'm building however it doesn't appear to be registering in VS2008 properly. Here is the structure:
The custom validator component "CustomVal" is written in a namespace of "Validators" in "Validators.vb" contained in a Web Control Library project which has a root namespace of "AS" making the component "AS.Validators.CustomVal"
This library is 'built' using VS 2008's Build option and I then copy the AS.dll to the /bin directory of the web site.
On the web page I'm wanting to use the component on I've got the following line in the top of the page:
<%@ Register TagPrefix="asv" Assembly="AS" Namespace="AS.Validators" %>
Further down the page where I want to use the component I've got:
<asv:CustomVal runat="server" id="CustomVal1"></asv:CustomVal>
As far as I can determine this should be working, but it's not. When adding the <asv:CustomVal> tag, VS.2008 reports:
Element 'CustomVal' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.
Also, I'm not getting any intellisense for <asv: but I'm not sure if this is to be expected or not.
Any help would be appreciated. I'm wanting to contain several sub's as well as custom components in the 'AS' control library and it would be used on several sites so I want to keep the namespace separation.
Feb 07, 2009 10:25 PM|Danny117|LINK
Go back a little. Stop at copy dll.
Reference the project from your website. RightClick add existing project. RightClick references...Projects Tab select the project. VS then handles coping of the dll and as a bonus you can debug set break points by simply setting the project configuration
to debug. Its that in a nut shell I have great confidence you can do this Anubis.
Feb 08, 2009 12:17 AM|Anubis09|LINK
Thanks for the reply. I have tried this as well; however I have added the reference using this method by selecting the .dll file using the 'browse' section of 'Add Reference'; there are no projects listed under the projects tab.
Further, when attempting to run the web site (dispite the warning that the control is not known) I get the following error which I feel may be related:
Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Thanks for your help.
Feb 08, 2009 12:46 PM|Danny117|LINK
Add your control project to your website. Then add reference...The projects tab will work.
Feb 11, 2009 05:14 AM|Anubis09|LINK
Thanks again for the reply; unfortunately that didn't work, however I have solved it in the mean time. The problem existed becasue it was being developed on a mapped network drive. It threw me at first as the methods were shown in object browser but when
putting them in the project VS encountered security issues and didn't work as expected.
Through the use of this link:
http://support.microsoft.com/?id=320268 I was able to successfully resolve the issue.