Skip to main content
June 16, 2006
Answered

Compiler Error Message: BC30451: Name 'UserEmail' is not declared.

  • June 16, 2006
  • 1 reply
  • 720 views
Have the message when I test the page. Anyone sugest a solution please?
Compiler Error Message: BC30451: Name 'UserEmail' is not declared.

Page code below.


<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="dsUsers"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_conSQLPerenelle") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_conSQLPerenelle") %>'
CommandText='<%# "SELECT dbo.Users.UserEmail, dbo.Users.UserPassword FROM dbo.Users WHERE dbo.Users.UserEmail=@UserEmail AND dbo.Users.UserPassword=@UserPassword" %>'
Expression='<%# IsPostBack %>'
Debug="true"
><Parameters>
<Parameter Name="@UserEmail" Value='<%# IIf((Request.Form("UserEmail") <> Nothing), Request.Form("UserEmail"), "") %>' Type="NVarChar" />
<Parameter Name="@UserPassword" Value='<%# IIf((Request.Form("UserPassword") <> Nothing), Request.Form("UserPassword"), "") %>' Type="NVarChar" />
</Parameters></MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />

<script language="VB" runat="server">
Protected Sub Page_Load(ByVal Src As Object, ByVal E As EventArgs)
' Don't cache this page.
Response.Expires = -1
Response.AddHeader("Pragma", "no-cache")
Response.AddHeader("cache-control", "no-store")

' Check user credentials entered on the page
If (UserEmail.Value = dsUsers.FieldValue("UserEmail",Nothing)) &&(UserPassword.Value = dsUsers.FieldValue("UserPassword",Nothing)) Then
' The user has been authenticated.
' 1. Create the authentication ticket.
' 2. Redirect to the appropriate page.

' 1. Create the authentication ticket.
' Create and use the forms authentication ticket.
FormsAuthenticationTicket ticket = New FormsAuthenticationTicket(1,
Request.Form("UserEmail"),
DateTime.Now, ' issue time
DateTime.Now.AddMinutes(30), ' expires in 30 minutes
False, ' not persistent
Dim ' role assignment gets stored in the UserData As "Users")

' Create a new (encrypted) HttpCookie using the ticket just created
' and name it accordingly to the value specified in the <forms> element
' in the web.config file.
Dim cookie As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName,FormsAuthentication.Encrypt(ticket))

' Add the cookie to the outbound response.
Response.Cookies.Add(cookie)

' Redirect as appropriate.
Dim ReturnUrl As String
If Request.QueryString("ReturnURL") Is Nothing Then
ReturnUrl = "/client-area/index.aspx"
Else
ReturnUrl = Request.QueryString("ReturnURL")
End If
Response.Redirect(ReturnUrl)

Else
Msg.Text = "Invalid Credentials: Please try again"
End If
End Sub
</script>


This topic has been closed for replies.
Correct answer
Answered myself. JUst named the imput fields incorrectly. Couple of other problems also but sorted and now working fine...

1 reply

Correct answer
June 17, 2006
Answered myself. JUst named the imput fields incorrectly. Couple of other problems also but sorted and now working fine...