assaultkitty
asked on
Context error
Experts I tried to make the changes in the markup on my own and to several errors. So, I will show you what I did so that you will know that I am trying to do the assignment on my own. Well these are the errors.
Error 71 The name 'curUser' does not exist in the current context C:\Course Technology\CIS Programming\ASP .NET Programming\Data Files\Chapter.09\Chapter\S kywardAvia tion\Login .aspx.cs 13 13 C:\...\SkywardAviation\
Error 72 The name 'curUser' does not exist in the current context C:\Course Technology\CIS Programming\ASP .NET Programming\Data Files\Chapter.09\Chapter\S kywardAvia tion\Login .aspx.cs 16 35 C:\...\SkywardAviation\
This my attempt to correct the error in the markup.
<asp:Login ID="curUser" runat="server" />
I removed it.
here is the code.
<%@ Page Language="C#" Debug="true" AutoEventWireup="true" CodeFile="Login.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Skyward Airlines</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="callback_navtop">
<tr>
<td width="56%" height="60" class="logoname">
Skyward Airlines
</td>
<td width="44%">
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="menu">
<tr>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
<div align="center">
<a href="index.htm">Home</a>< /div>
</td>
</tr>
</table>
</td>
<td class="cellbackmenuover">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
<div align="center">
<a href="ffClubPage.aspx"><fo nt color="#20809F">Frequent Flyers</font></a></div>
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuextend" >
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" bgcolor="#FFFFFF" class="cellbackhmrightexte nd">
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="172" rowspan="4" valign="top" class="cellbacksubmenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="209" valign="top" class="submenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="cellbackpromobtmext end">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30" valign="top">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td height="350" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="12%" height="45">
</td>
<td width="53%">
</td>
<td width="35%">
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<h1>
Frequent Flyer Program</h1>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<h2>
Returning Members</h2>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<form id="loginForm" runat="server">
<div>
<asp:TextBox id="account" runat="server"/>
<asp:TextBox id="password" runat="server"/>
<asp:Label id="badLogin" runat="server"/>
</div>
</form>
<h2>
New Members</h2>
<p>
<a href="Registration.aspx">E nroll in Skyward Airlines Frequent Flyer program.</a>
</p>
</td>
<td>
<div class="c3">
<table width="168" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/spic_001.jpg" width="168" height="209" alt="Visual formatting image" />
</td>
</tr>
<tr>
<td height="30" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cellbackhmright">
<tr>
<td width="100%" height="50" bgcolor="#DADADA" class="whiteline">
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td class="promotext">
New Frequent Flyer members can now earn 2,000 Bonus Miles for taking their first
flight.
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr valign="top">
<td height="30">
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="12%">
</td>
<td width="76%" class="btmmenu">
<a href="index.htm">Home</a> | Frequent Flyers<br />
© 2010 Skyward Airlines
</td>
<td width="12%">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</p>
<p>
</p>
<p>
</p>
</body>
</html>
using System;
using System.Collections.Generic ;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (curUser.Read())
{
HttpCookie flyerIDObject = new HttpCookie("flyerID");
flyerIDObject.Value = curUser["flyerID"].ToStrin g();
flyerIDObject.Expires = DateTime.Now.AddDays(30);
Response.Cookies.Add(flyer IDObject);
Response.Redirect("ffClubP age.aspx") ;
}
}
}
This is homework. Please help! I do not know which asp: to use.
Error 71 The name 'curUser' does not exist in the current context C:\Course Technology\CIS Programming\ASP .NET Programming\Data Files\Chapter.09\Chapter\S
Error 72 The name 'curUser' does not exist in the current context C:\Course Technology\CIS Programming\ASP .NET Programming\Data Files\Chapter.09\Chapter\S
This my attempt to correct the error in the markup.
<asp:Login ID="curUser" runat="server" />
I removed it.
here is the code.
<%@ Page Language="C#" Debug="true" AutoEventWireup="true" CodeFile="Login.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Skyward Airlines</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="callback_navtop">
<tr>
<td width="56%" height="60" class="logoname">
Skyward Airlines
</td>
<td width="44%">
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="menu">
<tr>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
<div align="center">
<a href="index.htm">Home</a><
</td>
</tr>
</table>
</td>
<td class="cellbackmenuover">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
<div align="center">
<a href="ffClubPage.aspx"><fo
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuextend"
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" bgcolor="#FFFFFF" class="cellbackhmrightexte
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="172" rowspan="4" valign="top" class="cellbacksubmenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="209" valign="top" class="submenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="cellbackpromobtmext
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30" valign="top">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td height="350" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="12%" height="45">
</td>
<td width="53%">
</td>
<td width="35%">
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<h1>
Frequent Flyer Program</h1>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<h2>
Returning Members</h2>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<form id="loginForm" runat="server">
<div>
<asp:TextBox id="account" runat="server"/>
<asp:TextBox id="password" runat="server"/>
<asp:Label id="badLogin" runat="server"/>
</div>
</form>
<h2>
New Members</h2>
<p>
<a href="Registration.aspx">E
</p>
</td>
<td>
<div class="c3">
<table width="168" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/spic_001.jpg" width="168" height="209" alt="Visual formatting image" />
</td>
</tr>
<tr>
<td height="30" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cellbackhmright">
<tr>
<td width="100%" height="50" bgcolor="#DADADA" class="whiteline">
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td class="promotext">
New Frequent Flyer members can now earn 2,000 Bonus Miles for taking their first
flight.
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr valign="top">
<td height="30">
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="12%">
</td>
<td width="76%" class="btmmenu">
<a href="index.htm">Home</a> | Frequent Flyers<br />
© 2010 Skyward Airlines
</td>
<td width="12%">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</p>
<p>
</p>
<p>
</p>
</body>
</html>
using System;
using System.Collections.Generic
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (curUser.Read())
{
HttpCookie flyerIDObject = new HttpCookie("flyerID");
flyerIDObject.Value = curUser["flyerID"].ToStrin
flyerIDObject.Expires = DateTime.Now.AddDays(30);
Response.Cookies.Add(flyer
Response.Redirect("ffClubP
}
}
}
This is homework. Please help! I do not know which asp: to use.
ASKER
Yes, I understand. The curUser is declared in an if statement. But, errors are in that statement. The if statement is:
if (curUser.Read())
{
Session["flyerID"] = curUser["flyerID"].ToStrin g();
Response.Redirect("ffClubP age.aspx") ;
}
Now, it is declared like this. the statement is correct. So, why is the curUser not being picked up. I checked the spelling. Still, I have the problem. I know it is not global. I thought I try the asp: before I called you. Anymore, thoughts. I am listening. Thanks.
if (curUser.Read())
{
Session["flyerID"] = curUser["flyerID"].ToStrin
Response.Redirect("ffClubP
}
Now, it is declared like this. the statement is correct. So, why is the curUser not being picked up. I checked the spelling. Still, I have the problem. I know it is not global. I thought I try the asp: before I called you. Anymore, thoughts. I am listening. Thanks.
curUser is not declared in that if statement. To declare a variable in C#, you need to explicitly set its type.
This declares a variable of type string in C#:
string str1;
Then in code I can assign a value to it:
str1 = "Hello";
If I have two sub routines inside my class and I declare a variable inside the first sub then try to assign a new value in the second...:
However, if I did this:
This declares a variable of type string in C#:
string str1;
Then in code I can assign a value to it:
str1 = "Hello";
If I have two sub routines inside my class and I declare a variable inside the first sub then try to assign a new value in the second...:
public partial class _Default : System.Web.UI.Page
{
protected void sub1()
{
string str1;
str1 = "Hello";
}
protected void sub2()
{
str1 = "Good-bye";
}
}
This code does not work because str1 does not exist in the "context" of sub2.However, if I did this:
public partial class _Default : System.Web.UI.Page
{
string str1;
protected void sub1()
{
str1 = "Hello";
}
protected void sub2()
{
str1 = "Good-bye";
}
}
This would work because str1 is declared in the parent block so it now exists in "context" with both sub routines.
ASKER
Ok. I do not understand what a curUser is. I do not understand if it is a userID. I removed one of the statment outside of the statement. I got the same error. I looked at the book. It did not say anything about putting anything outside of the if statement. I am attaching the page so that you can see it. I have worked around it for this long. But, I need to get around the project.
<%@ Page Language="C#" Debug="true" AutoEventWireup="true" CodeFile="Login.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Skyward Airlines</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="callback_navtop">
<tr>
<td width="56%" height="60" class="logoname">
Skyward Airlines
</td>
<td width="44%">
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="menu">
<tr>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
<div align="center">
<a href="index.htm">Home</a>< /div>
</td>
</tr>
</table>
</td>
<td class="cellbackmenuover">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
<div align="center">
<a href="ffClubPage.aspx"><fo nt color="#20809F">Frequent Flyers</font></a></div>
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuextend" >
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" bgcolor="#FFFFFF" class="cellbackhmrightexte nd">
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="172" rowspan="4" valign="top" class="cellbacksubmenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="209" valign="top" class="submenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="cellbackpromobtmext end">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30" valign="top">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td height="350" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="12%" height="45">
</td>
<td width="53%">
</td>
<td width="35%">
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<h1>
Frequent Flyer Program</h1>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<h2>
Returning Members</h2>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<form id="loginForm" runat="server">
<div>
<asp:TextBox id="account" runat="server"/>
<asp:TextBox id="password" runat="server"/>
<asp:Label id="badLogin" runat="server"/>
</div>
</form>
<h2>
New Members</h2>
<p>
<a href="Registration.aspx">E nroll in Skyward Airlines Frequent Flyer program.</a>
</p>
</td>
<td>
<div class="c3">
<table width="168" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/spic_001.jpg" width="168" height="209" alt="Visual formatting image" />
</td>
</tr>
<tr>
<td height="30" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cellbackhmright">
<tr>
<td width="100%" height="50" bgcolor="#DADADA" class="whiteline">
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td class="promotext">
New Frequent Flyer members can now earn 2,000 Bonus Miles for taking their first
flight.
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr valign="top">
<td height="30">
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="12%">
</td>
<td width="76%" class="btmmenu">
<a href="index.htm">Home</a> | Frequent Flyers<br />
© 2010 Skyward Airlines
</td>
<td width="12%">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</p>
<p>
</p>
<p>
</p>
</body>
</html>
using System;
using System.Collections.Generic ;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (curUser.Read())
{
Session["flyerID"] = curUser["flyerID"].ToStrin g();
Response.Redirect("ffClubP age.aspx") ;
}
}
}
curUser.Read---0002.pdf
<%@ Page Language="C#" Debug="true" AutoEventWireup="true" CodeFile="Login.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Skyward Airlines</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="callback_navtop">
<tr>
<td width="56%" height="60" class="logoname">
Skyward Airlines
</td>
<td width="44%">
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="menu">
<tr>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
<div align="center">
<a href="index.htm">Home</a><
</td>
</tr>
</table>
</td>
<td class="cellbackmenuover">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
<div align="center">
<a href="ffClubPage.aspx"><fo
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuunder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtmenu">
<img src="images/spacer.gif" width="95" height="1" alt="Formatting image" />
</td>
</tr>
<tr>
<td class="txtmenu">
</td>
</tr>
</table>
</td>
<td class="cellbackmenuextend"
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" bgcolor="#FFFFFF" class="cellbackhmrightexte
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="172" rowspan="4" valign="top" class="cellbacksubmenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="209" valign="top" class="submenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="cellbackpromobtmext
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30" valign="top">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td height="350" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="12%" height="45">
</td>
<td width="53%">
</td>
<td width="35%">
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<h1>
Frequent Flyer Program</h1>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<h2>
Returning Members</h2>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td>
<form id="loginForm" runat="server">
<div>
<asp:TextBox id="account" runat="server"/>
<asp:TextBox id="password" runat="server"/>
<asp:Label id="badLogin" runat="server"/>
</div>
</form>
<h2>
New Members</h2>
<p>
<a href="Registration.aspx">E
</p>
</td>
<td>
<div class="c3">
<table width="168" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/spic_001.jpg" width="168" height="209" alt="Visual formatting image" />
</td>
</tr>
<tr>
<td height="30" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cellbackhmright">
<tr>
<td width="100%" height="50" bgcolor="#DADADA" class="whiteline">
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td class="promotext">
New Frequent Flyer members can now earn 2,000 Bonus Miles for taking their first
flight.
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr valign="top">
<td height="30">
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="12%">
</td>
<td width="76%" class="btmmenu">
<a href="index.htm">Home</a> | Frequent Flyers<br />
© 2010 Skyward Airlines
</td>
<td width="12%">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="btmmenu">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</p>
<p>
</p>
<p>
</p>
</body>
</html>
using System;
using System.Collections.Generic
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (curUser.Read())
{
Session["flyerID"] = curUser["flyerID"].ToStrin
Response.Redirect("ffClubP
}
}
}
curUser.Read---0002.pdf
I have no idea what curUser is based on what you are providing. I don't recall the method Read() being applied to anything else but a file stream so that does not help me. The page you scanned from the book talks about changing from cookies to session variables. Look back in the book where they first describe adding cookies and maybe that's where curUser is first established.
If you know what the flyerID is supposed to be at that point in the code, you can hard code it in just to get past this problem.
Session["flyerID"] = "____fill in the blank__";
If you know what the flyerID is supposed to be at that point in the code, you can hard code it in just to get past this problem.
Session["flyerID"] = "____fill in the blank__";
ASKER
Are you looking at my code. I have the curUser hard coded and it still showing as an error. You are still not answering my question. Can you help me or let someone else help me?
Session["flyerID"] = curUser["flyerID"].ToStrin g();
Session["flyerID"] = curUser["flyerID"].ToStrin
ASKER
These are the one times that used the curUser variable. It is not a global variable.
Hard coding (also, hard-coding or hardcoding) refers to the software development practice of embedding what may, perhaps only in retrospect, be regarded as input or configuration data directly into the source code of a program or other executable object, or fixed formatting of the data, instead of obtaining that data from external sources or generating data or formatting in the program itself with the given input.
From here: http://en.wikipedia.org/wiki/Hard_coded
In plain terms it means typing in the actual value that curUser["flyerID"].ToStrin g() represents.
With that suggestion, I'm just trying to get you past this point so you can move on. Maybe if I had the book in front of me I could answer your question. Maybe the book is the problem. Maybe the author suddenly introduces curUser at that point in the book and it is completely unrelated to the project. Not likely, but there's no way for me to know. Google prints part of it here: http://books.google.com/bo oks, but it does not go back far enough. I'm trying!. B.T.W., I have no control over who posts suggestions to any question on this forum. It's wide open to all members.
From here: http://en.wikipedia.org/wiki/Hard_coded
In plain terms it means typing in the actual value that curUser["flyerID"].ToStrin
With that suggestion, I'm just trying to get you past this point so you can move on. Maybe if I had the book in front of me I could answer your question. Maybe the book is the problem. Maybe the author suddenly introduces curUser at that point in the book and it is completely unrelated to the project. Not likely, but there's no way for me to know. Google prints part of it here: http://books.google.com/bo
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for assaultkitty's comment #37819553
for the following reason:
I have been dealing with this problem for hours. I did not get any help from the expert. He was playing games with me!
Accepted answer: 0 points for assaultkitty's comment #37819553
for the following reason:
I have been dealing with this problem for hours. I did not get any help from the expert. He was playing games with me!
ASKER
I do not want to wait your time and especially mine because I have to turn this in tomorrow and I have not done my homework. The value is "flyerID". That is hard as it going to get. I showed you what I am working with If you would like me to upload the complete file. But, I do have access to a site that will allow me to share it with you. I tried to upload it and the EE said that certain files were not allowed on the site. You have to have a certain level of trust in what I am say. Do you have away that I can send the complete file to you?
@assultkitty,
Playing games? I have been extremely patient in explaining at length the reasons why I cannot tell you what curUser is. It's obvious that curUser is an object created earlier in the assignment. It will take some research on your part to find out where curUser is first declared. I'm not sitting I your seat. I can only work with the information you provide. You are frustrated, I get it, I've been there, but don't take it out on me. I'm not an employee of EE, I'm just another member like yourself. I don't get paid for it and I don't have a library of every book on computers ever written at my disposal. I think you misunderstand what EE is all about.
Moderator,
It's fine with me if the question is closed with zero points awarded. I just want you to be aware of this particular member's attitude.
Playing games? I have been extremely patient in explaining at length the reasons why I cannot tell you what curUser is. It's obvious that curUser is an object created earlier in the assignment. It will take some research on your part to find out where curUser is first declared. I'm not sitting I your seat. I can only work with the information you provide. You are frustrated, I get it, I've been there, but don't take it out on me. I'm not an employee of EE, I'm just another member like yourself. I don't get paid for it and I don't have a library of every book on computers ever written at my disposal. I think you misunderstand what EE is all about.
Moderator,
It's fine with me if the question is closed with zero points awarded. I just want you to be aware of this particular member's attitude.
If you want to upload a file of a type that EE does not allow, then just append an extension to the end of the file name of a type that EE does allow. I'll remove the appendage and open the file.
ASKER
Ok. Thank you.
ASKER
I deleted this file. I did not allow me to change the name.
SkywardAviation/App_Data/S kywardAvia tion_log.L DF
SkywardAviation/SkywardAvi ation - Shortcut.lnk
This file is not complete.
SkywardAviation.zip
SkywardAviation/App_Data/S
SkywardAviation/SkywardAvi
This file is not complete.
SkywardAviation.zip
There has to be more code associated with the Login page. I don't see a button to click on to log in or the associated event handler. Generally, you check the user's credentials against a database and if they validate, set the Session variable so you can access it from other pages. this all requires code which I don't see.
ASKER
I am going to try to scan some of the pages to this exercise.
ASKER
Page one
Page-1.pdf
Page-1.pdf
ASKER
page 2
ASKER
page 3
page-3.pdf
page-3.pdf
ASKER
Not a very good page 5
page-5.pdf
page-5.pdf
Ah ha! They are building on a previous assignment. They expect you to write the code for the Login page on the frequent flyer assignment the same way they taught you how to do it on the Gym Membership assignment. They are not providing it again. Does that make sense?
ASKER
Smart a...!
ASKER
Thank you. I will research just a little. Thanks again.
ASKER
So what page is the statement that I need to use?
All three of the pages you uploaded deal with aspx markup for designing a form on the Registration page and the associated code for writing the entered values to the database. None deal with how the user is authenticated on the Frequent Flyer log in page.
curUser would likely be declared somewhere on the "completed" login.aspx.cs. Yours is incomplete. Look at this instruction:
"Replace the first four statements in the if block within the try block..."
You don't have any of that on your Login.aspx.cs file. You have just a few lines inside the Page_Load. Where's the rest of the code?
curUser would likely be declared somewhere on the "completed" login.aspx.cs. Yours is incomplete. Look at this instruction:
"Replace the first four statements in the if block within the try block..."
You don't have any of that on your Login.aspx.cs file. You have just a few lines inside the Page_Load. Where's the rest of the code?
ASKER
still loading documents.
ASKER
Page 6
page-6.pdf
page-6.pdf
ASKER
ASKER
8
8.pdf
8.pdf
ASKER
9
9.pdf
9.pdf
ASKER
10
10.pdf
10.pdf
ASKER
11
11.pdf
11.pdf
ASKER
12
12.pdf
12.pdf
ASKER
13
13.pdf
13.pdf
ASKER
14
14.pdf
14.pdf
ASKER
15
15.pdf
15.pdf
ASKER
16
16.pdf
16.pdf
Okay, now we got it. Start at instruction #6 on page 476 to fill in what is missing on the Login.aspx.cs page. On page 477, in the middle, you will see where curUser is first declared:
SqlDataReader curUser;
SqlDataReader curUser;
ASKER
17
17-0001.pdf
17-0001.pdf
ASKER
That was the last page. I did not copy any of this code. I could not find it on the Internet. So, this has been a long process thus far.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. I must have skipped a whole page. Forgive me for any problems I may have cause. Thanks so much experts. I am going to be with you for a very long time.
ASKER
Excellent!
Don't sweat it. Before long you will probably be answering questions on EE. Thanks for the points.
ASKER
You are right! I am determined.
That tells me that curUser is a collection, not a server control, so posting the aspx markup does not help much. Adding a server control like asp:Login is not the way to go. You need to look back in your code to see where curUser is first declared. Then check it's context. Is it global? In other words, is it declared in the parent block of the code block where you are now trying to access it? Code blocks are delineated by { } brackets. They can be nested. That means curUser is only available to any code that is inside the same pair of { } where curUser is first declared.