Microsoft
Software
Hardware
Network
Question : ASp.net - issue with a function in a masterpage
I insert this into my asp.net page in and it says that it cant be used with Masterpages...
taken from this link...
http://support.micr
osoft.com/
kb/308157/
EN-US/
Private Function ValidateUser(ByVal userName As String, ByVal passWord As String) As Boolean
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim lookupPassword As String
lookupPassword = Nothing
' Check for an invalid userName.
' userName must not be set to nothing and must be between one and 15 characters.
If ((userName Is Nothing)) Then
System.Diagnostics.Trace.W
riteLine("
[ValidateU
ser] Input validation of userName failed.")
Return False
End If
If ((userName.Length = 0) Or (userName.Length > 15)) Then
System.Diagnostics.Trace.W
riteLine("
[ValidateU
ser] Input validation of userName failed.")
Return False
End If
' Check for invalid passWord.
' passWord must not be set to nothing and must be between one and 25 characters.
If (passWord Is Nothing) Then
System.Diagnostics.Trace.W
riteLine("
[ValidateU
ser] Input validation of passWord failed.")
Return False
End If
If ((passWord.Length = 0) Or (passWord.Length > 25)) Then
System.Diagnostics.Trace.W
riteLine("
[ValidateU
ser] Input validation of passWord failed.")
Return False
End If
Try
' Consult with your SQL Server administrator for an appropriate connection
' string to use to connect to your local SQL Server.
conn = New SqlConnection("server=loca
lhost;Inte
grated Security=SSPI;database=pub
s")
conn.Open()
' Create SqlCommand to select pwd field from the users table given a supplied userName.
cmd = New SqlCommand("Select pwd from users where uname=@userName", conn)
cmd.Parameters.Add("@userN
ame", SqlDbType.VarChar, 25)
cmd.Parameters("@userName"
).Value = userName
' Execute command and fetch pwd field into lookupPassword string.
lookupPassword = cmd.ExecuteScalar()
' Cleanup command and connection objects.
cmd.Dispose()
conn.Dispose()
Catch ex As Exception
' Add error handling here for debugging.
' This error message should not be sent back to the caller.
System.Diagnostics.Trace.W
riteLine("
[ValidateU
ser] Exception " & ex.Message)
End Try
' If no password found, return false.
If (lookupPassword Is Nothing) Then
' You could write failed login attempts here to the event log for additional security.
Return False
End If
' Compare lookupPassword and input passWord by using a case-sensitive comparison.
Return (String.Compare(lookupPass
word, passWord, False) = 0)
End Function
Answer : ASp.net - issue with a function in a masterpage
i have no idea on how to help but i think you should change the zone. It's not an MSDos issue!
Random Solutions
Can't access Exchange 2003 OWA from Internet
How to compress a string into a short representation in ASP.NET using C# or VB.NET?
is it possible virus affected VPN client spread virus in corporate network?
How to get the text from jsp file to database?
Remote Web Workplace different website address
stop error oxoooooo7b(OxF78D2524,OxC0
000034 will not load XP setup!!!!!!!
Sync Center and Moving Redirected Folder in SBS2008
Manually move Exchange 2003 mailstore to different disk
sysstat ntbackup problem "Registry Writer" has reported an error 0x800423f1
EtherChannel on Cisco 2960 switch intermittent dropped packet