I have one page in my entire site that the javascript won't work, I need it for the dropdown menu to work in IE6. I've made sure it's linked correctly, even tried putting it inline - nothing makes it work. Is there something in my ASP code that is preventing it from loading?? (I need p7exp.js to load)
Imports System.Data.SqlClient
Imports System.Data
Imports System.Configuration.Configuration
Partial Public Class Login
Inherits System.Web.UI.Page
#Region "Variables"
Dim cmd As New SqlCommand
Dim conn As New SqlConnection
Dim strSql As String
#End Region
#Region "Events"
''' <summary>
''' things that happen when the page loads
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' if we already have a session("UserID") then redirect to correct page
' this means they are already logged in.
If Session("UserID") Is Nothing Then
' nada
Else
If Session("UserID") > 0 Then
' go to the appropriate page for the usertype
Select Case Session("UserTypeID")
Case 3 ' Admin
Response.Redirect("AdminMain.aspx")
Case 4 ' Supplier
Response.Redirect("SupplierMain.aspx")
End Select
End If
End If
Me.btnLogin.Attributes.Add("onClick", "return ValidateEntry();")
Me.txtLogin.Focus()
End Sub
''' <summary>
''' close the db connection if open
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
CloseSqlDB()
End Sub
''' <summary>
''' go check the login and pw values for a match and determine if we have a admin or a supplier here
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Protected Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Try
' open up the database
OpenSqlDb()
' go see if we have a match
strSql = "Select ID, UserTypeID, ChangePW " & _
" From UserInfo " & _
" Where LoginID = '" & Me.txtLogin.Text.Trim.Replace("'", "''") & "'" & _
" AND BINARY_CHECKSUM(Password) = BINARY_CHECKSUM('" & Me.txtPW.Text.Trim.Replace("'", "''") & "')" & _
" And Password = '" & Me.txtPW.Text.Trim.Replace("'", "''") & "'" & _
" AND Active = 1 and UserTypeID IN(3,4) "
cmd.CommandText = strSql
Dim myrdr As SqlDataReader = cmd.ExecuteReader
Session("UserID") = ""
Session("UserType") = ""
Dim FoundOne As Boolean = False
Dim ChangePW As Boolean = False
While myrdr.Read
' assign the userid session variable
Session("UserID") = myrdr("ID")
' assign the usertype session variable
Session("UserTypeID") = myrdr("UserTypeID")
ChangePW = myrdr("ChangePW")
FoundOne = True
End While
myrdr.Close()
If Not FoundOne Then
Me.lblError.Text = "Invalid UserID / Password."
Session("UserID") = 0
Me.txtPW.Text = ""
Me.txtPW.Focus()
Exit Sub
End If
' update the last logged in date
strSql = "Update UserInfo Set LastLoggedInDate = GETDATE() Where ID = " & Session("UserID")
cmd.CommandText = strSql
cmd.ExecuteNonQuery()
' if the UserInfo.ChangePW flag is true - direct user to the ChangePW.aspx page
If ChangePW Then
Response.Redirect("ChangePW.aspx")
End If
' go to the appropriate page for the usertype
Select Case Session("UserTypeID")
Case 3 ' Admin
Response.Redirect("AdminMain.aspx")
Case 4 ' Supplier
Response.Redirect("SupplierMain.aspx")
End Select
Catch ex As Exception
Me.lblError.Text = ex.Message
End Try
End Sub
#End Region
#Region "Subs"
''' <summary>
''' this routine will make the connection to the database
''' </summary>
''' <remarks></remarks>
Protected Sub OpenSqlDb()
Dim connstr As String = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")
cmd = New SqlCommand
conn = New SqlConnection(connstr)
conn.Open()
cmd.Connection = conn
End Sub
''' <summary>
''' close the connection if it's open
''' </summary>
''' <remarks></remarks>
Protected Sub CloseSqlDB()
If conn.State = ConnectionState.Open Then
conn.Close()
conn.Dispose()
End If
End Sub
#End Region
#Region "Functions"
#End Region
End Class
Why don't you try to debug the static version of the page? save it as HTML and then debug. Once that is doing what it should be doing, you can go back to the dynamic version and see what is different.
If it's a big page and difficult to debug, simplify the page by throwing out markup that doesn't affect your problem. The smallest file that contains the problem is usually the simplest to fix.
Ok - Here is the deal - I am a web designer, I do not know anything about asp, debugging, and whatnot, and my developer will not help me on this. Is there a way around this? Has anyone had this same issue?