Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Is This Correct

Reply
Thread Tools

Is This Correct

 
 
Keith Chadwick
Guest
Posts: n/a
 
      11-05-2003
I am migrating an existing ASP application over to .NET as a learning exercise. The existing application uses a lot of xsl and xml transformations to render each page. Stored as an application variable is an xml set that contains all the language strings for the web site. Each page contains a 3 transformations. The first being the navigation bar, second the body for the current page and lastly the footer transformation. The header and footer xsl files are also stored as application variables as they are used on every page. The body xsl file is loaded per page. Each xsl file is rendered against the xml language set and placed on the current page.

So in moving this to the .NET I want to do a similar implementation. Within the global.asax file I am loading the header and footer pages in the application cache as thus:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

'----------------------------------------------------------------
' Assign Database Connection String
'----------------------------------------------------------------
Context.Cache("dbCnctstr")="Server=myserver;UID=me ;PWD=pwd;database=db"

'----------------------------------------------------------------
' Load the header and footer xsl files to application
'----------------------------------------------------------------
Dim xslNAVBAR As New MSXML2.DOMDocument30()
xslNAVBAR.load(Server.MapPath("Admin/XSL/clnt.navbar.xsl"))
Context.Cache("xslNAVBAR") = xslNAVBAR
Dim xslFOOTER As New MSXML2.DOMDocument30()
xslFOOTER.load(Server.MapPath("Admin/XSL/clnt.footer.xsl"))
Context.Cache("xslFOOTER") = xslFOOTER

End Sub

Am I correct in assuming that the above xsl document objects are being placed in the application 'CACHE'? I have been informed to use the application cache because it is thread safe. Now within a ASPX page can I reference either of these objects with Context.Cache("name")?

The language xml set is a little more difficult. I am trying to create a public class that handles the load of the data and subsequent methods I will need later on. Basically trying to replicate several functions I had in ASP into a logical class. My class is entitled Language within the AllianceNet application and does not inherit or import anything. One of the methods I have is entitled LoadLanguage, as seen below:

Public Class Language
Public Function LoadLanguage(ByVal AssignCache as Boolean)
' create database connection
' Enumerate xml auto recordset

Dim xmlLANG as New MSXML2.DOMDocument30()
' Load xml data from sql server auto xml recordset into xmlLANG object

if AssignCache Then
System.Web.HttpContext.Current.Cache("xmlLANG")=my xmlLangObj
end if
return
End Class

Now in the Application_Start() routine in the global.asax I have added.

Dim clsLang As New allianceNet.Language()
clsLang.LoadLanguage(True)

Another reason I need to separate out the load of the language XML is that there are times I need to reload the xmlLANG data on cue from a ASPX page.

So basically what I am asking is am I on the right track. I do find it the application level scope fairly confusing as there seems to be contradictory information between the books I have and the information I receive via other mediums.

Any feedback would be appreciated.

Cheers

Keith







 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
simulation result is correct but synthesis result is not correct J.Ram VHDL 7 12-03-2008 01:26 PM
Uploaded File Empty but in correct folder with correct name froil Perl Misc 12 03-02-2006 01:21 PM
Correct White Balance Doesn't Mean Correct Color?? jim evans Digital Photography 28 12-27-2005 05:10 AM
correct or not correct? Dan HTML 7 10-02-2003 10:16 PM
To correct my program. please, check to find errors and correct me. joon Java 1 07-08-2003 06:13 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57