Global.asa TO Global.asax
Posted on 2006-11-01
Guys, I'm having a difficult time with something. I am a newbie to asp.net and I do apologize for the rudimentary question, but I have nowhere else to turn. I have inherited a web site that uses classic asp and a global.asa file to store some session info. However, I have been instructed to begin creating a new set of pages to add .NET functionality to the already existing site.
Here's some code from an already existing global.asa:
<-- begin code -->
<SCRIPT LANGUAGE="VBScript" RUNAT="SERVER">
Set rst= Server.CreateObject("ADODB.Recordset")
auth_user = ucase(request.servervariables("auth_user"))
if left(auth_user,9)="mydomain\" then auth_user=right(auth_user,x-9) end if
if left(auth_user,4)="myd\" then auth_user=right(auth_user,x-4) end if
sql = "select num,name from people where userid='" & auth_user & "'"
con.open "Provider=SQLOLEDB; Data Source=126.96.36.199; Initial Catalog=people; User ID=myid; Password=xxxxxxx"
rst.open sql, con
if not rst.eof then
session("name") = rst("name")
session("num") = rst("num")
session("name") = ""
session("num") = ""
<-- End Code -- >
The site uses the session vars "name" and "num" at various places through the site. Works great for classic asp application. Now, I've created a new virtual directory to use asp 2.0 code and I wish to create a global.asax file to do the same as the global.asa. However, I have not found much information on the Internet on how to accomplish this feat. Would any of you so kind as to how to point me into the right direction?