Sie sind auf Seite 1von 7

Stargate .

Net Architecture/Design Decisions

ASP

1) Use of migration tool defines most variables without a current definition as Object - not the best, but
does work
• Should we correctly define variables?
2) To enable better use of server side processing, should some of the pages be migrated to web forms?
3) Replace "include" files with vb code but not dlls?
4) Can we move any business logic in the asp pages into vb code?
5) Should we look to introduce any Ajax controls?
6) Should we look to incorporate any other specific .Net code features?
7) Should we use viewstate to maintain some state data in place of using hidden fields - this create its
own hidden fields!? Alternatives may be profile/cache.
8) How to manage session data - currently using session object.
9) Is there any impact on the way we do load balancing - especially with sticky sessions currently being
required.

• Understand what the migration tool does and list changes needed to .aspx pages to "rectify" situation.

"The following are the issues uncovered from the test migration:

1. Stargate ASP code has been structured in a specific way to enable common code to be extracted into
'include' files. These files contain utility functions. When the migration tool ran it was unable to
resolve the 'include' file references.
2. The migration tool should not be seen as providing a working solution. In fact this was far from so as it
changed some code that should not be changed.
3. The migration tool was a good starter, but even using that, the majority of the code needs to be
reviewed to check what it has done. Some common problems were seen and can be documented to
ensure that the code is then amended to correct this situation. Correction of these errors could then be
automated.
"

• Include file issues

" As mentioned earlier, the ASP migration tool could not find the include files. Once the Visual Studio
website had been created, this became more of an issue. The error checking within Visual Studio would
often produce errors due to the 'complex' structure of includes used in Stargate. Includes are seen by many
as being an 'old fashioned' solution to providing common code. Several different approaches were
attempted to maintain the 'include' file approach, but they all had issues and did not resolve the Visual
Studio error checking approach.

This issue mainly affected the utility include files. The solution landed upon was to convert these include
files into functions within a new 'class' file. It is possible to do this and keep the separation of code as in the
existing utility include files.

• Each function had to be converted to 'public shared'


• session.Contents was replaced with 'HttpContext.Current.Session.Item'.
• Server.CreateObject was replaced with CreateObject. (??? check if this is correct approach - does this
affect where the object is created????).
• Response.Redirect was replaced with HttpContext.Current.Response.Redirect
• Request.ServerVariables.Item was replaced with HttpContext.Current.Request.ServerVariables.Item
"

• Variable declarations

"
Another issue was with variables declared in one file and expected to be present for use in another. This has
to be resolved to overcome the error in Visual Studio. There is no one correct answer, but a solution can
usually be found.
"

• JavaScript

"
A further issue discovered was around the javascript code. The current method of 'including' javascript files
did not work.

<script language="JavaScript1.2" src="../general/javascript/Utilities.js"></script>

The javascript can be written in .aspx pages with a language statement of javascript1.2 and then included as
per normal includes.

<script language="JavaScript1.2">

This works, but it might not be the best solution. There are new facilities around javascript that could be
used, but time did not allow this to be fully investigated - e.g. use of page.?????????????????
"

• other changes made during test migration were…

"
Removed include of utilities.asp, secutil.asp, partutil.asp, workutil.asp, generateProduct.asp.

AddPartnerTags

Had to define the variable bCallCentre and add the code to set this variable.

If Len(CStr(utilclass.getCCNav)) = 0 Then
bCallCentre = False
Else
bCallCentre = True
End If

PageHeader/PageFooter

Both pages were amended to get them to work - variable definitions and moving some code!

perviouspage variable was defined as prevpage in RSAAudit to avoid conflict

I think we need to re-do the navigation process around current and previous page.
getdropdownlists

Had to change path in code for VS debugging - ??

Had to add utilclass. in HTML

XML

Had to add reference to MSXML4

Had to amend one definition to add XMLDocument30

Had to amnd path to XML by adding :18838/dotnet as the root path for VS debugging ???

QAS

Currently has Application.Lock() and Application.unlock() - these do not work in the .vb class used in
.NET?? look at other ways of achieving this.

flgAction - when not defined in

RTEUtil

iPartnerId would normally be set somewhere in another include, but due to restructure as a .vb class then it
has to have code added to get the partner id.

iPartnerId = UtilClass.getPartner()

XML

Location of XML directory caused several problems - had to copy it into SGScripting/dll directory - not
sure what app.path was set to. (this was before trying to migrate any vb code).
"

COM Conversion

1) Review places where code is accessing external objects - should these be replaced by specific .NET
objects? What is the performance implication of using COM Interop?
• MSXML
• QAS
2) Multithreading is used by default - are all Stargate objects capable of multi-threading or should this be
turned off? If to be turned off then how to do it?
3) Make use of option strict on - this ensures all variables are defined
4) Implement IDisposable interface to ensure that objects are correctly disposed of in the code. Must set
objects to closed/nothing.
5) Fully qualify all types with complete namespace.
6) Where code has been replicated between objects as classes, create single DLL

Database access

1) Is there a tool that really converts ADODB to ADODB.NET?


2) Is the ADODB.NET migration in line with estimates?
3) Should some SQL be moved into stored procedures as part of the migration?

.Net General

1) Will "themes" be used? (what is this?)


2) What about Net Security providers, Web Forms security, the Membership API, Role-Based security,
Web.config rules, Transport Layer Security?
3) Can we use FireFox (developer toolbar and firebug)?
4) Need to produce new development standards/guidelines for migration and post migration

Other general notes

Plan migration approach in detail


• what to do about includes
• strong naming of vb.net projects (DLLs)
• do we migrate adodb to ado.net - if so what about use of tool? or hand craft?
• what to do with repeated code in vb projects
• what about rundate? leave as wsf?
• remove any aspcompat="true" statements
• java script include issues
• what to do about session data?
• what needs to be configured in web.config?

Other VB thoughts

Migrate VB code by using Visual Studio to migrate the VB project.

First app migrated was SGDataSecurity - the only issue in migration was the strong naming. The migration
process tried to add a strong name and generated a .snk file. This was resolved by commenting out the
strong name in the assemblyinfo.vb file and building from there (also ran sn -Vr, but this appeared to fail,
so ran -Vu which also appeared to fail - will need to check this on the next dll!). There is also a property
page around strong name.

Other things tried was using sn to generate a public/private key pair (-k to generate the public/private key
pair and -p to then extract the public key).
The asp code had to be changed to remove the createobject and use xxxx = new sgdatasecurity.security()
(being the class of the object). Also added an import statement, but don't think this was necessary.

Changed the function to return an sgdatasecurity.security rather than a generic object - this is more efficient
and should be replicated through the asp code!! i.e. all definitions of the object should be replaces with dim
xxxx as sgdatasecurity.security

Second project migrated was SGUtilityEvent. Same issue with strong names as for the first application.
Tried adding name in assemblyinfo.vb as:

<Assembly: AssemblyKeyFile("c:\stargate\dotnet\stargatepubpri.snk")>

then ran sn -Vr to avoid verification. This worked. The ran sn -Vx to
remove all strong name verification and both still worked! Checked back
on previous project and found the snk line commented out, so tried to
comment it out and re-build. This now failed on loading SGUtilityEvent
as it was not strong named. Found that the properties page of the
previous project had the signing check box ticked and the snk file
selected, so repeated for SGUtilityEvent and then tested - this now
worked.

Moved on to a third project SGDataUtility. This had a refence to the


COM component for SGUtilityEvent - had to re-register SGUtilityEvent to
get the migration assistant to work. Having migrated then un-registered
the COM component. Having migrated, noted that this project included
the code for UtilityEvent.vb - need to review whether this should be
removed from this project and reference made to the new assembly. For
some reason this project did not add the snk file to assemblyinfo.vb,
nor create the snk file - not sure why!

Removed reference created to interop.SGUtlityEvent and added reference


to .NET project SGUtilityEvent. Is it necessary to have this as well as
the code!! Need to review all this.

Changed asp code to use new VB.NET code and ran…

First problem was on My.Application.Info.DirectoryPath which was set to


"C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\dotnet\5b77117f\2eb6cc09\assembly\dl3\69c824f4\1772436e_dd75c701"

changed code to reference xml in c:\stargate\dotnet etc need to review


what to do for production running. (Also found this in DataUtility.vb -
in multiple projects).

Left an error in the code and traced through to event logging - this
would appear to cause a problem and left the system hanging - the first
issue was around the parameter to copymem - the two "as any"s needed to
be replaced with integer and string. The hang appeared to happen on the
End Sub!

Further to above, writing to event log needs changes:


• change to use imports system.diagnostics
• Replace use of advapi32 as follows:
' Private Declare Function RegisterEventSource Lib "advapi32.dll"
Alias "RegisterEventSourceA"(ByVal strServerName As String, ByVal
strEventSource As String) As Integer
Private Sub RegisterEventSource(ByVal strEventSource As String)

If Not System.Diagnostics.EventLog.SourceExists(strEventSource)
Then
System.Diagnostics.EventLog.CreateEventSource(strEventSourc
e, "Application")
End If

End Sub

' Private Declare Function ReportEvent Lib "advapi32.dll" Alias


"ReportEventA" (ByVal hEventLog As Integer, ByVal wType As Short, ByVal
wCategory As Short, ByVal dwEventID As Integer, ByRef lpUserSid As
String, ByVal intNumStrings As Short, ByVal lnDataSize As Integer,
ByRef arrStrings As String, ByRef varData As String) As Boolean
Private Sub ReportEvent(ByVal strSource As String, ByVal strdata As
String, ByVal wType As Integer, ByVal wCategory As Short, ByVal
dwEventID As Integer)
' Dim ELog As New EventLog("Application", "", strSource)
EventLog.WriteEntry(strSource, strdata, wType, dwEventID,
wCategory)
End Sub

Public Sub LogEvent(ByVal lngLevel As Integer, ByVal lngEventNo As


Integer, ByVal strDescription As String, Optional ByVal strLocation As
String = "")

Dim strLoc As String

' strLoc = vbCrLf & "--" & vbCrLf &


My.Application.Info.Title & " (V" & My.Application.Info.Version.Major &
"." & My.Application.Info.Version.Minor &
My.Application.Info.Version.Revision & ") " & vbCrLf & "--" & vbCrLf &
" " & strLocation
' RecordEvent(lngEventNo, lngLevel,
My.Application.Info.Title, vbCrLf & "--" & vbCrLf & strDescription,
strLoc)
strLoc = vbCrLf & "--" & vbCrLf &
My.Application.Info.AssemblyName & " (V" &
My.Application.Info.Version.Major & "." &
My.Application.Info.Version.Minor &
My.Application.Info.Version.Revision & ") " & vbCrLf & "--" & vbCrLf &
" " & strLocation
RecordEvent(lngEventNo, lngLevel,
My.Application.Info.AssemblyName, vbCrLf & "--" & vbCrLf &
strDescription, strLoc)

End Sub

Public Sub ASPLogEvent(ByVal lngLevel As Integer, ByVal lngEventNo As


Integer, ByVal strDescription As String, ByVal strLocation As String)

RecordEvent(lngEventNo, lngLevel, "Stargate", vbCrLf & "--" &


vbCrLf & strDescription, vbCrLf & "--" & vbCrLf & strLocation)
End Sub

Private Sub RecordEvent(ByVal lngEventNumber As Integer, ByVal


lngEventType As Integer, ByVal strSource As String, ByVal strEventData
As String, ByVal strLocation As String)

' Dim lngEventLogHandle As Integer


' Dim lngMessage As Integer
'Dim lngResult As Integer
Dim strdata As String
strdata = strEventData & " " & strLocation
' lngEventLogHandle = RegisterEventSource("", strSource)
RegisterEventSource(strSource)

' lngMessage = GlobalAlloc(&H40S, CInt(Len(strdata) + 1))

' CopyMemory(lngMessage, strdata, CInt(Len(strdata) + 1))

' If Not ReportEvent(lngEventLogHandle, lngEventType, 0,


lngEventNumber, 0, 1, CInt(Len(strdata) + 1), lngMessage, lngMessage)
Then
ReportEvent(strSource, strdata, lngEventType, 0, lngEventNumber)
'an error has occured but unable to do anything

' Call GlobalFree(lngMessage)

' DeregisterEventSource(lngEventLogHandle)
End Sub

Das könnte Ihnen auch gefallen