Re: Retrieving state information from a middle tier

From: Vaibhav (consultvaibhav_at_yahoo.com)
Date: 02/25/05


Date: Fri, 25 Feb 2005 16:20:27 -0500

Hi Ian

Assuming the user is using one db at a time. This can be one of the possible
ways to solve the problem

For the first session call user makes to the com+ object, asp page should
pass userid/password/dbname/sessionid to the COM object.

You should have a predefined named xml file created and stored on the
machine hosting the COM components

Now this very first call can make session root entry into an xml file like
this
<UserSession Id="UserSessionId">
    <UserName>UserName</UserName>
    <Password>Encrypted(UserPassword) </Password>
    <UserDB>DatabaseName</UserName>
</UserSession>

Now in all your subsequent call to the object you just have to pass the
'UserSessionId' for any object call. The object will get for the user data
information from the xml files based on the supplied sessionid; based on
that object will return information from the correct database. Also the
object can return some UserAuthenticated flag(on first invocation) which can
be stored in some session variable and you can check it value before making
object calls from asp.

You can create as many entries as you want in the file also you can remove
the entry once the user logs out or his session expires.

HTH

"Ian Williamson" <IanWilliamson@discussions.microsoft.com> wrote in message
news:76C929A5-D999-4689-9250-05CEE0D1BD5E@microsoft.com...
>I will try to be more concise.
>
> We have a presentation tier hosted on a web server where all our .aspx
> pages
> and associated code behind live. We have a middle tier which is made up
> of a
> number of COM+ libraries. These two tiers currently reside on the same
> computer, but the long term vision is to implement .NET remoting to allow
> the
> tiers to be physically separated.
>
> The current implementation only allows for one database to be served up.
> Because of this, the middle tier is used to host the server and database
> name
> in the registry. Our clients may have multiple databases that support the
> application (test, training, production, etc). For them to change between
> databases, they have to modify the registry and then cycle IIS so that the
> associated caches are reloaded with the appropriate data from the newly
> specified database.
>
> We now wish to support multiple database connections. So, when a user
> logs
> into the application, not only do they specify user name and password,
> they
> also pick from a list of available databases (test, training, production,
> etc). Since the database connection is now associated to a user, we can
> no
> longer use the middle tier as the source of the connection properties.
>
> Everytime data is requested, there must be some mechanism to specify which
> server and database the data should be pulled from. The nasty brute force
> method is to pass this information along with every call from the web page
> into the middle tier. In my research, I found that you could expose the
> ASP
> Intrinsics of a page and consume them from a serviced component.
>
> When a user logs in, the server and database they have selected is stored
> to
> the Session object. When a request is made from one of the pages to
> retrieve
> data, the middle tier retrieves this Session information using the
> following:
> ASPTypeLibrary.Session oSession =
> (ASPTypeLibrary.Session)ContextUtil.GetNamedProperty("Session");
>
> This call utilizes the ASPTypeLibrary COM library.
>
> For a web page to be able to expose it's Intrinsics, the property
> ASPCompat="true" must be added to the Page directive. By setting this
> property, the page now executes in a Single Threaded Apartment (STA) as
> opposed to it's default Multi Threaded Apartment (MTA). Various articles
> point to the fact that this may impact performance and cause deadlocks.
>
> My question is, how have other people implemented solutions where they
> need
> to specify connection properties across tiers.
>
> Is there a simpler way of persisting my connection properties into my
> middle
> tier? (I know almost nothing of COM+)
> Is the solution I am using common?
> Are the performance issues significant?
> Whidbey will apparently no longer support ASPCompat, so are new methods
> being established to be able to retrieve information from the caller?
>
> Thank you.
>



Relevant Pages

  • RE: Retrieving state information from a middle tier
    ... Add a factory in the middle tier. ... Use the user input selrection (test, production, etc.), ... > The current implementation only allows for one database to be served up. ... > longer use the middle tier as the source of the connection properties. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Please! Doesnt anyone know a better way to do this?
    ... account, they need to automatically be directed to the page to enter data ... session variable on the Account page. ... I assume here that you're checking a database when the user attempts to ... When a new user attempts to login or clicks to register, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: VirtualPathProvider and Application Restart
    ... the session state to the Database Server and move a lot of lightweight ... to unload it from the AppDomain. ... When you update an ASPX file, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Horizontal scaling - advice needed
    ... the session can be unambiguously proxied to the right backend server, ... To start with have a single database machine. ... Full database clustering is challenging, but if your site is making you lots ... For transient session state, ...
    (comp.lang.ruby)
  • Re: choices regarding where to place code - in the database or middle tier
    ... Before Oracle decided to allow you to write stored procedures in Java, ... Even without Java existing, let alone being hosted in the database, you ... of languages that they developed for the middle tier, ... the .NET developers out there will be faced with this choice. ...
    (comp.lang.java.databases)