User controls in .net 2.0

I am using Visual Studio Express 2005.  I am trying to share user controls across applications using the "virtual directory trick" mentioned in the following articles :

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q324785
http://authors.aspalliance.com/JimRoss/Articles/ShareUserControls.aspx

This works in VS 2002, but it does not work in VS Express 2005.  Did MS purposefully eliminate this "trick" from .net 2.0, or am I just not implementing it right?

Sharing user controls across applications is a perfectly natural thing to want to do.  It is one of the best ways to ensure a uniform "look and feel" throughout a site.  It doesn't seem like MS wants to give us a good way to do this.  Yes, I know about precompilation and server controls.  However, it is essential that the HTML designers at my company be able to change the appearance of these user controls at will, without requiring help from the programmers.  Thus, precompilation and server controls do not solve the problem.

I simply can't be the only one in this boat.

0
Afro
11/30/2005 6:40:03 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

2 Replies
610 Views

Similar Articles

[PageSpeed] 34

 Afro Blanca wrote:

This works in VS 2002, but it does not work in VS Express 2005.  Did MS purposefully eliminate this "trick" from .net 2.0, or am I just not implementing it right?



Are you seeing an error message?
Scott
http://www.OdeToCode.com/blogs/scott/
0
bitmask
11/30/2005 9:23:03 PM
Yes.  Here are the steps that I followed:

1) Created a directory called /Shared
2) In this directory, I put TestCtl.ascx.  This is my user control.
3) Created a project called VirtualDirTest.  Created a page called Tester.aspx that used my user control.
4) Went into inetmgr, and created a virtual directory in /VirtualDirTest that mapped to /Shared
5) However, when I tried to add the Register directive to my Tester.aspx file, I got the following errors:
File 'Shared/TestCtl.ascx' was not found. 
The file '/VitualDirTest/Shared/TestCtl.ascx' does not exist.

As far as virtual directories go:
1) Should my /Shared directory be set up as a virtual directory in my site root?
2) I noticed that VS 2005 Express doesn't automatically make web project directories virtual directories in the way that VS 2002 did.  Should I make my /VirtualDirTest directory a virtual directory in my site root?

When I ran this test originally, I didn't have /VirtualDirTest or /Shared set up as virtual directories in my site root.  However, after my initial test didn't work, I tried various combinations of virtual directory setups, and got the same results.


0
Afro
11/30/2005 11:23:46 PM
Reply:

Similar Artilces:

How to validate controls on a .NET 2.0 Web user Control
Hi Guys, (ASP.NET 2.0 / C#) I've looked thorugh every post on validating web user controls (and know about Pter Blum's Professional Validation and More package) - but can't seem to get my head around whre to start. I have a web user control, called wucICL.ascx on a we page called AddEditInvestment.aspx.  I would like to validate a couple of DropDownLists (ddlAccounts and ddlContacts) when the Insert and Update buttons are clicked on the AddEdit Investment page. The other controls on the AddEditInvestments page belong to a validation group called All Validators and the DropDownL...

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0 #2
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! There are too many differences for one email - - from 1.0 to 1.1 (not a whole lot of real change, other than fixes, at least compared to 1.1 to 2.0) With 2.0, there were many new declarative controls, with many new ideas added in With 3.0, it's a superset of 2.0 - instead of replacing the installation completely, it just 'added on' new functionality - I would...

Access .Net 2.0 Application from .Net 2.0 Web Site
I need to populate a specific form in a .Net desktop application from a .net web application.  Is there an easy way to go about this? Hi, Based on my understanding, you want to start an executable application from your ASP.NET websit, right? We can invoke Process.Start method (http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx) to launch an executable application from ASP.NET application. Note: Please keep in mind, the ASP.NET application is running on the server, so it will start the executable application that exists in the server.   I look...

web.config problems when upgrading from .NET 2.0 Beta to .NET 2.0 release version
We uninstalled .NET 2.0 Beta and replaced it with .NET 2.0 release version.  And it messed everything up.  All applications now give weird errors indicating the lack of web.config files, despite the fact that they already have web.config files in place.  For example, the following error occurs even though the web.config file has <customErrors="Off">: Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for securit...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! Have a look into this links http://en.wikipedia.org/wiki/.NET_Framework http://blogs.msdn.com/mohammadakif/archive/2006/12/03/net-3-0-different-versions-of-the-net-framework.aspx http://www.codeproject.com/aspnet/ComparisonASP1xASP20.aspAshok Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that m...

Invoke JavaScript from .Net 2.0 Windows User Control hosted on web page
We are developing a .Net 2.0 Windows User Control that we host within a normal web page in IE7/IE6 using the following syntax:<object id="simpleControl1" classid="http:ControlAssemblyName.dll#ControlNamespace.UserControl1" height="300" width="300" VIEWASTEXT>     <param name="TestParam" value="Simple Windows User Control"></object> We want to be able to invoke JavaScript from within the control, and this has been done previously by us using COM-based ActiveX controls. We are trying the following, and have also made sure we set "FullTrust" runtime secur...

Bad web.config in AJAX.NET 1.0 under .NET 2.0 Express
My setup is MS.NET v2.0 with the C# and Web Express editions of 2005. I also installed the AJAX 1.0 release with the respective toolkit as indicated in the AJAX.NET site. However, when I create a new project I am presented with the usual bare bones default.aspx and the web.config. However the web.config shows a lot of warnings and errors.One of them was being that the "requiredPermission" (or something like that) attribute was not recognized. Somewhere on the net there is a post of a correction to the DotNetConfig.xsd schema file in VS.2005 so I used it and it got rid of THAT warning.&n...

User Controls with .net 2.0
   This is going to seem like a blanket question, but I have been looking high an low for a simple explanation and haven't been very lucky.  I just converted a project from 1.1 to 2.0 and noticed the <@ Reference> directives at the top of my pages that had (and still have) <@Register> directive for user controls I built.Can someone please explain to me in plain english what the pupose of the  @Reference directive is?  I have been able to dig up that it has to do with referencing user controls and having them compile, but have found absolutely no good exam...

Clickonce deployment anyone (DW.NET 2.0 and .NET 2.0)?
I saw someone had posted a question about this already, and there were no responses. So I am hoping that this will get some. We had problems with the previous version of DW.NET 1.5 + VS2003 when attempting to deploy applications via a web server. So many problems that we eventually decided to run off a network drive (which is OK if your user base doesn't roam around the country). Anyway, we gave up on DW.NET, and started to use the datagrid control. Since then, much has changed. Our development team now has VS2005 professional and may start using DW.NET 2.0 (pending my inv...

.NET 3.0 or .NET 2.0?
I'm going to move my exiting software to .net soon. I'm just wondering if I should wait for the .NET 3.0 framework to be released or if I can start with the 2.0 now? I'd say you can go ahead and move your code to .Net 2.0 as .Net 3.0 uses the CLR version 2.0.Basically, .net 3.0 is .net 2.0 PLUS some new features for presentation (GUI), communication and workflow process.  So the compiler as well as the language features used by the 2.0 runtime will be the same in 2.0 and 3.0"Never argue with an idiot; He will drag you down to his level and beat you with experienc...

.NET 2.0 Data Connection (.NET 2.0 Beta Data Provider)
I have installed the .NET 2.0 Beta Data Provider, in the server explorer in Visual Studio 2005 I have tried to connect to this provider but I can not see it in the list. Is there something else you need to do to see this other than what is in the instructions or is this not supported yet? Hi Dean, I assume you mean ASE ADO.NET 2.0 Beta. I'm attaching the html readme for this product that you should have from downloading it. Are you talking about using Server Explorer to see the Provider? This functionality isn't working yet and should be available on GA or shortly ...

Cannot pass target control value to web method (autocomplete, .NET 2.0, toolkit release 1.0.20229)
I am trying to use 1.020229 in VS 2008, and maybe that is my problem, but I want to use VS 2008 and target a .NET 2.0 framework and I have tried several of the other toolkit controls in this same environment (e.g. tabpanel) and they seem to work. The problem is that when I use "public string[] GetSuggestions(string prefix, int n)" in the web service code behind, it never gets invoked.  But if I remove the parameters (i.e. "public string[] GetSuggestions()", then it does, but of course in that case the results have nothing to do with the text entered in the target ...

Sharing cookie between .NET 1.1 and .NET 2.0 web app
I have two servers A and B.  A hosts .NET 1.1 web apps, while B hosts .NET 2.0 web apps.  I have a common login page written in .NET 2.0 (thus it's on server B).  In order to share the cookie, I set the machine key attributes (validation and encryption) of all apps to the same keys, and set all .NET 2.0 web apps to use decryption="3DES".  But for some reasons, my .NET 1.1 still cannot read the cookie generated by the .NET 2.0 login page.  Anyone has similar problem before?  Am I missing anything? Thanks. WenWen I am afraid you can only share t...