Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   error in simple example (http://www.velocityreviews.com/forums/t59097-error-in-simple-example.html)

Ming Zhu 07-07-2003 10:45 AM

error in simple example
 
Hi, all,

I'm new to .NET and ASP.NET. I only use .NET Framework 1.0. I'm
reading the book "C# developer's guide to ASP.NET". But I find there
is no place to download the code used inside this book.

Anyway, my problem is the following example doesn't work. It's a
simple page using HTML control Anchor. But I meet the following
error. Is it because it requires some new features provided only by
..NET Framework 1.1? Who can tell me why and how to solve it. Thanks
a lot!

Server Error in '/CsGuildeToASP' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource
required to service this request. Please review the following specific
parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'HtmlControls.Anchor'.

Source Error:


Line 1: <%@ Page language="c#" Codebehind="Anchor.aspx.cs"
AutoEventWireup="false" Inherits="HtmlControls.Anchor" %>
Line 2: <!DOCTPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <html>


Source File: D:\ZM\Study\Microsoft\CsGuildeToASP\Chapter2\Ancho r.aspx
Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.288;
ASP.NET Version:1.0.3705.288



The following is the ASP.NET page file, Anchor.aspx.
--------------------------------------------------------------------------------
<%@ Page language="c#" Codebehind="Anchor.aspx.cs"
AutoEventWireup="false" Inherits="HtmlControls.Anchor" %>
<!DOCTPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Dynamically Generated Anchor</title>
<meta name="GENERATOR" Content="Micorosoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" Content="JavaScript">
<meta name="vs_targetSchema"
Content="http://schemas.microsoft.com/intellisense/ie5">
</head>

<body>
<form id="Anchor" method="post" runat="server">
<a id="AnchorTag" runat="server">Test Anchor</a>
</form>
</body>
</html>
--------------------------------------------------------------------------------


The following is the code file, Anchor.aspx.cs.
--------------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace HtmlControls
{
public class Anchor : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlAnchor AnchorTag;

private void Page_Load(object sender, System.EventArgs e) {
if( Page.Request.IsSecureConnection) {
AnchorTag.HRef = "https://www.deeptraining.com";
AnchorTag.InnerText = "Secure Link";
} else {
AnchorTag.HRef = "http://www.deeptraining.com";
AnchorTag.InnerText = "Unsecure Link";
}
}

#region Web From Designer generated code
override proctected void OnInit(EventArgs e) {
//
// CODEGEN: This call is required by the ASP.NET Web Form
Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
--------------------------------------------------------------------------------


All times are GMT. The time now is 08:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57