Link to home
Start Free TrialLog in
Avatar of reeftec
reeftecFlag for United States of America

asked on

Using SQL inl Global.asax to set a session value

How do I use the global.asax file to establish a session value that is obtained from a sql database. The connect string is contained in the web.config file.  

The sql query would be similar to this:  select empl_id from employee
Where session.contents ("username") =   employee.user_name.

Session.contents("userid")= employee.empl_id
The global.asax file currently contains the following:
<%@ Application Language="VB" %>
<script runat="server">
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)        
        Dim User As System.Security.Principal.IPrincipal
        User = System.Web.HttpContext.Current.User
        Dim username As String
        username = User.Identity.Name               
        Session.Contents("username") = User.Identity.Name

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Espavo
Espavo
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial