Some outstanding ASP .NET questions

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello:

We here have been working in ASP .NET for a long time now. We have
made tons of successful applications even without knowing the
specifics about the tools. However, the amount of effort it takes to
manage some application features seems way more complicated than they
should. I would like for someone to answer my questions as to how they
do something or how it is intended.

1) Whenever we log a user in, we create a database connection for that
user. Typically, we store the connection (yes, the connection) in the
Session and use a Singleton pattern to retrieve it back later:

public static OracleConnection GetConnection()
{
if (HttpContext.Current.Session["MY_CONNECTION"] == null)
HttpContext.Current.Session["MY_CONNECTION"] = new
OracleConnection("");
return
(OracleConnection)HttpContext.Current.Session["MY_CONNECTION"];
}

However, I am not sure if storing the connection in the session is a
wise idea. It works, but I am becoming wary of sticking anything in
the session. How do you handle database connections, etc. in your
ASP .NET application? Do you recreate a new connection at each
postback? for each query?

2) We noticed that TableAdapters have the ability of persisting across
postbacks. I couldn't examine the source code enough to see how it
worked. My original thought was that Microsoft stored the underlying
DataTable/DataSet in the session. However, I couldn't find it
anywhere. How does MS persist TableAdapters?

3) When navigating around a web site, we typically store table key
information in the session so that we can query information off those
keys. Is it appropriate to store table key information in the session?
You see, I come from the days of POST, hidden fields, etc. I feel
weird putting information in the session like that. But, then again,
what would the session be for?

4) ASP .NET Object Data Sources allow the select command to get its
parameters from many places. However, we here typically have a class
or two that manage our session variables. Similar to the GetConnection
example above, we have a bunch of static methods that retrieve the
session and do our type handling. It is a lot more safe that way.
However, ObjectDataSources don't allow us to get parameter information
from an object or class. Is there a better way of passing parameter
information to an ObjectDataSource?

5) MultiViews can be very useful. But at the same time, they cause
serious issues once the page size gets large enough. We have an
application where modifying the interface is a 15 minute task. We
realized the problem is due to paging and VS storing undo/redo
actions; this causes OutOfMemoryExceptions a lot. Is ASP .NET better
geared toward single page applications with one big MultiView or many
pages linked with session variables? or is there a better way to pass
information around?

6) For some reason, prior to authentication/authorization, the session
dictionary appears to be null occasionally. We have never been able to
figure it out. In some application, the session always exists, but for
some reason, it becomes null in other applications. We are not sure
what causes it. However, we have noticed that it doesn't happen once
the user is logged in. The question is, is there a new session created
once a user logs in? is there a session at all prior to log in?

We need to know because our membership and role provider classes both
need database connections. Where is the best place to store a
connection for a provider class? should we be storing connections at
all? I was thinking in the Application dictionary, since it belongs to
all users.

--

I think that will do for now. Thank you for filling in any of the
holes.

Thanks,
Travis
.



Relevant Pages

  • Re: APPN Connection z/os - AHHC / LLC2.
    ... implied that you session stopped for a while and then continued. ... the ANNC link is a type 2.1 connection. ... I would suggest trying to limit the request unit size used over the type 2.1 ... MAXDATA operand when defining a PU statement for an adjacent link station ...
    (bit.listserv.ibm-main)
  • Re: Remote desktop deadlock on XP SP2
    ... the TS connection is frozen, even if I specify a wait timeout. ... TermSrv.dll creates a new session for the purpose of displaying the logon ... lives on a DPC routine for the network miniport ... the network packets are encapsulated and decapsulated in UDP. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: JES-APPL
    ... Then there has been a session initiation request - which can only happen over an available session path - this isn't any of your flaky IP, ... Unless the NJE application on the AS/400 has consistently been caught in the middle of being activated in some way - highly unlikely I would expect - this is not a timing problem. ... Since the connection is necessarily in place, there is no problem with the connection - just in case a modem is involved - which, given a "switched" definition is used, is not impossible, but unlikely. ...
    (bit.listserv.ibm-main)
  • Re: os users, sessions, and connections.
    ... From what I've read a session is a logged connection. ... do the following (paddr is the address of the process ... select sid, serial#, paddr, username from v$session ...
    (comp.databases.oracle.server)
  • [NEWS] Vulnerability in the TCP Protocol Allows RST Spoofing (Cisco Advisory)
    ... A vulnerability in the Transmission Control Protocol (TCP) specification ... the connection may get automatically ... Here is an example of a normal termination of a TCP session: ... Access control lists should also be deployed as close to the edge ...
    (Securiteam)