473,382 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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
}
}
--------------------------------------------------------------------------------
Nov 17 '05 #1
0 1804

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
2
by: Ian Griffiths | last post by:
I have been given a schema, instances of which I'm required to be able to consume and generate. I'd like to be able to manipulate these instances as DataSets internally in my application. The...
8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
21
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So...
2
by: David Williams | last post by:
Hi all, I get errors when compiling the .cpp file below, both on Visual Studio and G++. 01: //------------------------------------------------- 02: template <typename Type> 03: class Outer 04:...
2
by: Shawn Convington | last post by:
Hey, I am facing a problem which seems srange to me. I have a simple dll class file i have created in its own projected, so it can be inherited and used by others (for example security.dll here)....
18
by: robert | last post by:
Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: m, m-err, o, o-err, r-coef,r-coef-err ? Or a formula to to compute the 3 error ranges? ...
35
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
1
by: sean_walsh | last post by:
Hi From classic ASP, I had a custom error handling situation that was quite simple. Errors were all redirected to Error.asp. This page would check 2 settings, EmailErrorMessage and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.