Architectural, design issue, please

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



Hi. I have the following problem:

The user has to be able to upload lists of PINS (in an Excel/CSV
format). Upon receiving them, the aspnet app must run many rather
complicated queries using the uploaded PIN list and the 'static' files
already in the database. To simplify my coding life, I have imagined
this solution:

a. each user, on login, is assigned a 'Session ID' number, composed of
the PIN of the user and Seconds(now), assuming that no user will login
that many times at the same time... (I should mayube use some other
scheme here, but this, I think, solves MOST of the concurrency
problems). Since Session("SessionID") might be lost if the server gets
low on resources, I save this number in a file on the disk and re-
populate Session ID if necessary (I will save it in the db on the
server, or maybe in cookies, if I can be sure that cookies will be
allowed by the users).

I now have a big problem - the queries I have to run are 1)
complicated 2) MIGHT involve many records and 3) will work with a
different dataset (different input PIN list) for each user logged in.

b. I order to avoid concurrency problems, on each upload, I insert the
contents of the file uploaded by the user (Excel/CSV) into a TEMP
table named ImportedPINS, together with the SessionID number which
will act as a selector. So if 5 users will be online at the same time,
each uploading, say, a list of 200 PINS, I will have in table
"ImportedPINS" a number of 1000 PINS, in 5 sets of 200 each,
differentiated mainly by the SessionID.

From now on, I will run all my queries with clauses like "WHERE
SessionID = "...", thus separating the datasets.

Because the 'ImportedPINS' table contains an ID column (identity),
which I would like to reset from time to time, and also I don't want
to let 'ImportedPINS' (and similiar tables) grow to much overtime, I:

c. I clean (i.e. recreate) these TEMP tables on "Application_End" in
Global.ASAX with code like this:

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)

Dim cnSQL As New SqlConnection
Dim cmd As SqlCommand

Try
Context.Cache.Remove("Templates")
'The session variables simply expire on session end...

'Clean up/recreate the temp tables ImportedFiles, DisplayFiles, etc:
cnSQL = New
SqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))
cnSQL.Open()

cmd = New SqlCommand("[CreateTableImportedPins]", cnSQL)
cmd.CommandType = CommandType.StoredProcedure
cmd.ExecuteNonQuery()

Catch ex As Exception

Finally
Try
'Explicitly close - don't wait on garbage collection.
cmd = Nothing
cnSQL.Close()
Catch ex As Exception

End Try
End Try
End Sub

Questions:

1. Is this architecture safe ? Does it make sense ? Is there any
other, more intelligent and hopefully not much more laborious,
solution ?

2. I have a problem - the code above, in Global.ASAX, in
Application_END, NEVER EXECUTES !!!! I wonder what's the problem...
Did I make a mistake ?

Thank you very much.
Alex.

.



Relevant Pages

  • Doc Management and Mailing List Component recommendations
    ... As we polish up our in-house CMS tool, ... - ability for people to upload a document and assign meta data to it ... So both a way to upload documents and a way to manage lists of these ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: repeated login prompt when uploading document to sharepoint library
    ... Client was experiencing a problem with lists in SPS 2003 areas. ... user belonging to the "contributor" security group tried to upload a ... group that had the "manage area" permission were able to upload ... permission will be unable to upload an item. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Future for VC++ Programmers
    ... May I ask why you choose singly-linked lists over doubly-linked lists? ... FORTRAN program in any language. ... number and therefore all computations were done by pin ... with geometry computed by a geometry module that took the board type as an input. ...
    (microsoft.public.vc.mfc)
  • Re: Simple sproc executes 240 times slower when called from asp.net than when called from QA
    ... My site's users will upload some "PIN" excel files. ... insert the contents of the excel file into a db table, ... many) execute perfectly - it's only this one which becomes extremely ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: newsletter APP NOT listserve
    ... the ability to be able to select the recipients for a particular letter ... "HIV" prevention program- upload lists can be csv txt excel doesnt really ... What are the requirements/characteristics of the "newsletter app" ...
    (freebsd-questions)