Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reusing user controls, forms, etc...
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00884626
Message ID:
00884686
Views:
18
Hi Doru,

If I am understanding you correctly, you don't want to create two ASP.NET projects. When you do that you have two separate virual directories and you will not be able to treat them as one application. You set forms authentication at the root directory of the application then you can have different web.config files for each directory that have different rights associated with the files contained in them. One ASP.NET project can have multiple web.config files associated with it by placing them in the different subfolders.

>I had a C# web solution - I'm using VS.NET 2003 -, let's call it S1, in the directory S1, containing a few web forms and a user control (the user control is a header for each page).
>
>I now need to create a new solution, S2, in a new virtual directory S2, having different requirements - one is that it must use forms authentication.
>I understand that in order to allow access to a 'member area', while still having a few pages that can be visited without login, you need to have two projects, so that you have two web.config files:
>-one in S2 directory with all forms that do not require authentication
>-one in S2/Sub, a 'child' directory of S1, with forms authentication in web.config
>I created the two projects, and adding a reference of S2 project to Sub seems to let me navigate from a page in S1 to one in Sub and back.
>Is this the correct approach?
>
>Now I would like to reuse the user control I created in S1, but I don't want references back to S1 in my new S2. I tried to add it as an existing item, or plain copy of files and bin directory, regardless, I can see references to S1.
>The user control is not very complex, so I created it from scratch in S2. That allows to add it to all forms in S1, but I cant add it to forms in Sub! If I do, I get the following error:
>
>Parser Error Message: The virtual path '/S2/ph.ascx' maps to another application, which is not allowed.
>Source Error:
>Line 1: lt%@ Page language="c#" Codebehind="dzm.aspx.cs" AutoEventWireup="false" Inherits="dzm.WebForm1" %gt
>Line 2: lt%@ Register TagPrefix="uc1" TagName="ph" Src="../ph.ascx" %gt
>Line 3: lt!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" %gt
>Line 4: ltHTMLgt
>

>Do I need to create the user control in each project?? I doubt it... but can't figure out how else to do it.
>
>TIA
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform