Link to home
Start Free TrialLog in
Avatar of Littlesey
Littlesey

asked on

XML Data Access Error with ASP.NET & Visual Studio .NET

Hi, I'm having an issue with the following code:

Imports System.Xml
Imports System.Data



Public Class xmlread
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim reader As XmlTextReader

        Try
            reader = New XmlTextReader(Server.MapPath("books.xml"))
            While reader.Read()
                Response.Write("<b>" & reader.Name & "</b> " & reader.Value & "<br />")
            End While
        Catch ex As Exception
            Response.Write("Error accessing file")
        Finally
            reader.Close()
        End Try
    End Sub

End Class

Which is generating thie following error message:

Parser Error Message: Could not load type 'adolearn.xmlread'.

Source Error:


Line 1:  <%@ Page Language="vb" AutoEventWireup="false" Codebehind="xmlread.aspx.vb" Inherits="adolearn.xmlread"%>
Line 2:  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3:  <HTML>
 
Does anyone have a clue on how to fix this?  I have a project set up in Visual Studio .NET called adolearn and the file generating the error is called xmlread.aspx.
ASKER CERTIFIED SOLUTION
Avatar of riyasjef
riyasjef

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of riyasjef
riyasjef

If u r using vs.net

Press Ctrl+shift+B

and execute the page..
Hi

What is the name of your project?
The inherits part  in the @ page should ideally contain
projectname.namespace.classname

if no namespace mentioned then
projectname.classname

This should be the cause of the problem.