Re: Asp.Net 2.0 Multiple Application Solutions



Steven,
Thanks for your help. I managed to fix the DataSet problem. I put it into my
Businesslogic layer and added a method for returning the connectionstring.
It seems to work as expected.

For the formsauthentication problem:
Each entity is a separate table in the DB therefore if I was to have the
entire solution in one website I could only use one
authorisation/authentication method (one login page). This page would then
need to check the given credentials against both DB tables in order to give
them access to their available areas. This is further complicated by the
fact that administrators have certian roles and clients do not.
I hope this makes sense to you, I initially wanted the login pages separate
because I see there is a distinct difference between administrators, clients
and each of the secured areas.

Thank you for your help once again.
Graham

"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:Y9dugwZzFHA.3928@xxxxxxxxxxxxxxxxxxxxxxxx
> Hi Graham,
>
> Welcome to ASPNET newsgroup.
> Regarding on the question you mentioned, here are some of my understanding
> and suggestion:
>
> 1. For formsauthentication, we can separate our web application into
> multiple parts (sub folders) and set separate access protection on
> different sections so that certain users/role can only access certain part
> of the application. So for you scenario, we can consider define two roles
> ,
> frontend user and backend admin, and admin can access those pages that
> resides in the admin folder and front end user can access pages in other
> normal application folders. We can put the front users and admins
> accounts
> in the same database (by default), or creating two separate database/table
> to store them. That's all ok within one single asp.net web application. So
> I'm a bit unclear on the
> =================
> The 2 entities (Admins and Clients) are separate objects in the data model
> (because of the completely different information pertaining to each), e.g
> a
> client would never become an admin and vice versa.
> =================
>
> IMO, we don't care about whether a client is also an admin, we just apply
> authorization setting for our web folder / pages so that those admin pages
> can only be accessed by administrators while normal pages can only be
> accessed by front client users.
>
> 2. For the TAbleAdapter, yes , when creating in asp.net 2.0 project, due
> to
> the dynamic compile model, the code file will be put in the App_Code
> folder
> and also can utilize the connectionStrings section in the web.config.
> While in other Class Library project, the VS.NET ide will by default
> choose
> to persiste the connectionStrings in the project assembly's settings data
> and after compilation it is not possible to flexibly modify them. So
> overcome this, currently we can use the following means;
>
> Create the DataSet/TableAdapters in a separate Class library project, and
> after we drag a TAble from the Server explorer and created the DataSet/
> TableAdapter, we open the DataSet.Designer.cs file , locate the the
> "InitConnection" function of the
> xxxTableAdapter class, it is the method that initialize the TableAdapter's
> connection property, it used to be something like:
>
> private void InitConnection() {
> this.m_connection = new System.Data.SqlClient.SqlConnection();
> this.m_connection.ConnectionString =
> DSLibrary.Properties.Settings.Default.NorthwindConnectionString;
> }
>
>
> we can modify it to
>
> private void InitConnection() {
> Object obj =
> System.Configuration.ConfigurationSettings.GetConfig("connectionStrings");
> ConnectionStringsSection css = obj as ConnectionStringsSection;
> string connstr =
> css.ConnectionStrings["LocalNorthwindConnStr"].ConnectionString;
> this.m_connection = new System.Data.SqlClient.SqlConnection();
> this.m_connection.ConnectionString = connstr;
>
> }
>
>
> Thus, it'll retrieve the connectionstring from the current Application's
> AppConfig(web.config for web app) and what we need to do in web
> application
> is just provide the proper connectionstring in app.config/web.config file.
>
> Thanks,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
>
>
>
>
> --------------------
> | From: "Graham" <enlighten@xxxxxxxxxxxxxxxxx>
> | Subject: Asp.Net 2.0 Multiple Application Solutions
> | Date: Mon, 10 Oct 2005 15:00:42 +1300
> | Lines: 180
> | MIME-Version: 1.0
> | Content-Type: multipart/alternative;
> | boundary="----=_NextPart_000_001A_01C5CDAB.62716EF0"
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> | Message-ID: <#LMIt5TzFHA.4032@xxxxxxxxxxxxxxxxxxxx>
> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | NNTP-Posting-Host: 222-152-202-93.jetstream.xtra.co.nz 222.152.202.93
> | Path:
> TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP1
> 5.phx.gbl
> | Xref: TK2MSFTNGXA02.phx.gbl
> microsoft.public.dotnet.framework.aspnet:349591
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | I have been having some fun learning and using the new Controls and
> methods in .Net 2.0 which will make my life in the future easier and
> faster. Specifically the new databinding practises and wizards.
> | But, I have found that trying to do something "outside the norm" adds a
> rather large level of complexity and/or data replication.
> | Background
> | I have been commissioned to create a web-based application for a client.
> It has a formsaunthentication secured backend for admins to login and
> manage system data (clients, categories, geographical regions and their
> related associations). It also has a frontend where users can search
> through the clients in the system and view their information. The frontend
> also contains a formsauthentication secured area where the clients can log
> in and edit some of their information. The 2 entities (Admins and Clients)
> are separate objects in the data model (because of the completely
> different
> information pertaining to each), e.g a client would never become an admin
> and vice versa.
> | I decided to use Visual Studio 2005 and .Net 2 for this project because
> it would give me a head start for when the new technologies are released
> in
> November.
> | The solution is split up into 3 layers - Data Access layer,
> Businesslogic
> layer, and Presentation layer (websites)
> | Problem
> | I think the main problem I have experienced is multiple
> formsauthentication methods in one website. Because the two entities both
> have to log into different areas (therefore different login methods) I
> could not find a way to do this without making the admin section a
> separate
> website within the solution (it would actually be a virtual directory in
> IIS once it is live). Once I did this, I found another problem with having
> to replicate data.
> | I decided early on in the project to make use of the new
> ObjectDataSource
> and the DataSet creation wizard within VS 2005. Both websites need to make
> use of this dataset. When you initially create the dataset it asks for a
> DB
> connection string which either has to be hardcoded into it (bad idea) or
> stored in the web.config (good idea). It then stores the created DataSet
> in
> the app_code directory of the website. This presents a problem when having
> multiple websites with a single solution (at the moment I have the dataset
> within both websites app_code directories).
> | Now you might be asking "why not have the DataSet in the Businesslogic
> or
> Data Access layers?". One reason - You have to have the DB connection
> string hardcoded into it, because it cant access the web.config from
> either
> of these layers. I understand that. But I havent found a way to set the
> connection string programatically nor does the DataSet compile if the
> ConnectionString property of each TableAdapter is set to "none".
> | Answers?
> | In short I would like to know if there is either:
> | A way to have multiple types of formsauthentication in a single
> website (and how); or
> | How I can have a shard DataSet somewhere out of a website so that it
> can be accessed by both websites.
> | I hope this makes sense and thank anyone that can provide me with any
> help.
> |
>


.