473,387 Members | 1,553 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,387 software developers and data experts.

problem with Inherits attribute

I encounter a problem.

I have three files:
index.aspx
index.aspx.vb
HTMLContentParser.vb (doesn't have the class WebForm1

I put all three file in the same directory.

when I ran index.aspx it has an error

"Could not load type 'HTMLContentParser.WebForm1'"

this is run line 1
Line 1: <%@ Page Language="vb" EnableViewState="false"
AutoEventWireup="false" Codebehind="Index.aspx.vb"
Inherits="HTMLContentParser.WebForm1"%>
This is the code of HTMLContentParser.vb.... Do I need to compile it first
before I upload it? What is my problem?

'''''''''''''''''''''''''''''
Imports System.IO
Imports System.Net
Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Public Class HTMLContentParser
Function Return_HTMLContent(ByVal sURL As String)
Dim sStream As Stream
Dim URLReq As HttpWebRequest
Dim URLRes As HttpWebResponse

Try

URLReq = WebRequest.Create(sURL)
URLRes = URLReq.GetResponse()

sStream = URLRes.GetResponseStream()
Return New StreamReader(sStream).ReadToEnd()

Catch ex As Exception

Return ex.Message

End Try
End Function

Function ParseHTMLLinks(ByVal sHTMLContent As String, ByVal sURL As
String) As ArrayList
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()

rRegEx = New Regex("a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _
RegexOptions.IgnoreCase Or RegexOptions.Compiled)

mMatch = rRegEx.Match(sHTMLContent)

While mMatch.Success
Dim sMatch As String
sMatch = ProcessURL(mMatch.Groups(1).ToString, sURL)
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While

Return aMatch

End Function

Function ParseHTMLImages(ByVal sHTMLContent As String, ByVal sURL As String)
As ArrayList
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()

rRegEx = New Regex("img.*src\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _
RegexOptions.IgnoreCase Or RegexOptions.Compiled)

mMatch = rRegEx.Match(sHTMLContent)

While mMatch.Success
Dim sMatch As String
sMatch = ProcessURL(mMatch.Groups(1).ToString, sURL)
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While

Return aMatch

End Function

Private Function ProcessURL(ByVal sInput As String, ByVal sURL As String)

'Find out if the sURL has a "/" after the Domain Name
'If not, give a "/" at the end
'First, check out for any slash after the
'Double Dashes of the http://
'If there is NO slash, then end the sURL string with a SLASH
If InStr(8, sURL, "/") = 0 Then
sURL += "/"
End If

'FILTERING
'Filter down to the Domain Name Directory from the Right
Dim iCount As Integer
For iCount = sURL.Length To 1 Step -1
If Mid(sURL, iCount, 1) = "/" Then
sURL = Left(sURL, iCount)
Exit For
End If
Next
'Filter out the ">" from the Left
For iCount = 1 To sInput.Length
If Mid(sInput, iCount, 4) = "&gt;" Then
sInput = Left(sInput, iCount - 1) 'Stop and Take the Char before
Exit For
End If
Next

'Filter out unnecessary Characters
sInput = sInput.Replace("&lt;", Chr(39))
sInput = sInput.Replace("&gt;", Chr(39))
sInput = sInput.Replace("&quot;", "")
sInput = sInput.Replace("'", "")

If (sInput.IndexOf("http://") < 0) Then
If (Not (sInput.StartsWith("/")) And Not (sURL.EndsWith("/"))) Then
Return sURL & "/" & sInput
Else
If (sInput.StartsWith("/")) And (sURL.EndsWith("/")) Then
Return sURL.Substring(0, sURL.Length - 1) + sInput
Else
Return sURL + sInput
End If
End If
Else
Return sInput
End If
End Function
End Class

Nov 19 '05 #1
3 2044
are you running it by wither presing Play or F5? If so, then its not trying
to open up index, its trying to open what was set as the start page for
debugging, which may or may not be the same default document for your wen
site. In the solution explorer, right=click on Index.aspx and select Set As
Start Page.
"jty202" <jt****@gmail.com> wrote in message
news:O0****************@tk2msftngp13.phx.gbl...
I encounter a problem.

I have three files:
index.aspx
index.aspx.vb
HTMLContentParser.vb (doesn't have the class WebForm1

I put all three file in the same directory.

when I ran index.aspx it has an error

"Could not load type 'HTMLContentParser.WebForm1'"

this is run line 1
Line 1: <%@ Page Language="vb" EnableViewState="false"
AutoEventWireup="false" Codebehind="Index.aspx.vb"
Inherits="HTMLContentParser.WebForm1"%>
This is the code of HTMLContentParser.vb.... Do I need to compile it first before I upload it? What is my problem?

'''''''''''''''''''''''''''''
Imports System.IO
Imports System.Net
Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Public Class HTMLContentParser
Function Return_HTMLContent(ByVal sURL As String)
Dim sStream As Stream
Dim URLReq As HttpWebRequest
Dim URLRes As HttpWebResponse

Try

URLReq = WebRequest.Create(sURL)
URLRes = URLReq.GetResponse()

sStream = URLRes.GetResponseStream()
Return New StreamReader(sStream).ReadToEnd()

Catch ex As Exception

Return ex.Message

End Try
End Function

Function ParseHTMLLinks(ByVal sHTMLContent As String, ByVal sURL As
String) As ArrayList
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()

rRegEx = New Regex("a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _
RegexOptions.IgnoreCase Or RegexOptions.Compiled)

mMatch = rRegEx.Match(sHTMLContent)

While mMatch.Success
Dim sMatch As String
sMatch = ProcessURL(mMatch.Groups(1).ToString, sURL)
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While

Return aMatch

End Function

Function ParseHTMLImages(ByVal sHTMLContent As String, ByVal sURL As String) As ArrayList
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()

rRegEx = New Regex("img.*src\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _
RegexOptions.IgnoreCase Or RegexOptions.Compiled)

mMatch = rRegEx.Match(sHTMLContent)

While mMatch.Success
Dim sMatch As String
sMatch = ProcessURL(mMatch.Groups(1).ToString, sURL)
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While

Return aMatch

End Function

Private Function ProcessURL(ByVal sInput As String, ByVal sURL As String)
'Find out if the sURL has a "/" after the Domain Name
'If not, give a "/" at the end
'First, check out for any slash after the
'Double Dashes of the http://
'If there is NO slash, then end the sURL string with a SLASH
If InStr(8, sURL, "/") = 0 Then
sURL += "/"
End If

'FILTERING
'Filter down to the Domain Name Directory from the Right
Dim iCount As Integer
For iCount = sURL.Length To 1 Step -1
If Mid(sURL, iCount, 1) = "/" Then
sURL = Left(sURL, iCount)
Exit For
End If
Next
'Filter out the ">" from the Left
For iCount = 1 To sInput.Length
If Mid(sInput, iCount, 4) = "&gt;" Then
sInput = Left(sInput, iCount - 1) 'Stop and Take the Char before
Exit For
End If
Next

'Filter out unnecessary Characters
sInput = sInput.Replace("&lt;", Chr(39))
sInput = sInput.Replace("&gt;", Chr(39))
sInput = sInput.Replace("&quot;", "")
sInput = sInput.Replace("'", "")

If (sInput.IndexOf("http://") < 0) Then
If (Not (sInput.StartsWith("/")) And Not (sURL.EndsWith("/"))) Then
Return sURL & "/" & sInput
Else
If (sInput.StartsWith("/")) And (sURL.EndsWith("/")) Then
Return sURL.Substring(0, sURL.Length - 1) + sInput
Else
Return sURL + sInput
End If
End If
Else
Return sInput
End If
End Function
End Class

Nov 19 '05 #2
I uploaded the files to my host service in their own directory. I didn't
open this in Visual Studio, I open the file using IE.
"David Jessee" <dj*****@houston.rr.com> wrote in message
news:Oh**************@TK2MSFTNGP15.phx.gbl...
are you running it by wither presing Play or F5? If so, then its not trying to open up index, its trying to open what was set as the start page for
debugging, which may or may not be the same default document for your wen
site. In the solution explorer, right=click on Index.aspx and select Set As Start Page.
"jty202" <jt****@gmail.com> wrote in message
news:O0****************@tk2msftngp13.phx.gbl...
I encounter a problem.

I have three files:
index.aspx
index.aspx.vb
HTMLContentParser.vb (doesn't have the class WebForm1

I put all three file in the same directory.

when I ran index.aspx it has an error

"Could not load type 'HTMLContentParser.WebForm1'"

this is run line 1
Line 1: <%@ Page Language="vb" EnableViewState="false"
AutoEventWireup="false" Codebehind="Index.aspx.vb"
Inherits="HTMLContentParser.WebForm1"%>
This is the code of HTMLContentParser.vb.... Do I need to compile it

first
before I upload it? What is my problem?

'''''''''''''''''''''''''''''
Imports System.IO
Imports System.Net
Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Public Class HTMLContentParser
Function Return_HTMLContent(ByVal sURL As String)
Dim sStream As Stream
Dim URLReq As HttpWebRequest
Dim URLRes As HttpWebResponse

Try

URLReq = WebRequest.Create(sURL)
URLRes = URLReq.GetResponse()

sStream = URLRes.GetResponseStream()
Return New StreamReader(sStream).ReadToEnd()

Catch ex As Exception

Return ex.Message

End Try
End Function

Function ParseHTMLLinks(ByVal sHTMLContent As String, ByVal sURL As
String) As ArrayList
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()

rRegEx = New Regex("a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _
RegexOptions.IgnoreCase Or RegexOptions.Compiled)

mMatch = rRegEx.Match(sHTMLContent)

While mMatch.Success
Dim sMatch As String
sMatch = ProcessURL(mMatch.Groups(1).ToString, sURL)
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While

Return aMatch

End Function

Function ParseHTMLImages(ByVal sHTMLContent As String, ByVal sURL As

String)
As ArrayList
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()

rRegEx = New Regex("img.*src\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _ RegexOptions.IgnoreCase Or RegexOptions.Compiled)

mMatch = rRegEx.Match(sHTMLContent)

While mMatch.Success
Dim sMatch As String
sMatch = ProcessURL(mMatch.Groups(1).ToString, sURL)
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While

Return aMatch

End Function

Private Function ProcessURL(ByVal sInput As String, ByVal sURL As

String)

'Find out if the sURL has a "/" after the Domain Name
'If not, give a "/" at the end
'First, check out for any slash after the
'Double Dashes of the http://
'If there is NO slash, then end the sURL string with a SLASH
If InStr(8, sURL, "/") = 0 Then
sURL += "/"
End If

'FILTERING
'Filter down to the Domain Name Directory from the Right
Dim iCount As Integer
For iCount = sURL.Length To 1 Step -1
If Mid(sURL, iCount, 1) = "/" Then
sURL = Left(sURL, iCount)
Exit For
End If
Next
'Filter out the ">" from the Left
For iCount = 1 To sInput.Length
If Mid(sInput, iCount, 4) = "&gt;" Then
sInput = Left(sInput, iCount - 1) 'Stop and Take the Char before
Exit For
End If
Next

'Filter out unnecessary Characters
sInput = sInput.Replace("&lt;", Chr(39))
sInput = sInput.Replace("&gt;", Chr(39))
sInput = sInput.Replace("&quot;", "")
sInput = sInput.Replace("'", "")

If (sInput.IndexOf("http://") < 0) Then
If (Not (sInput.StartsWith("/")) And Not (sURL.EndsWith("/"))) Then Return sURL & "/" & sInput
Else
If (sInput.StartsWith("/")) And (sURL.EndsWith("/")) Then
Return sURL.Substring(0, sURL.Length - 1) + sInput
Else
Return sURL + sInput
End If
End If
Else
Return sInput
End If
End Function
End Class


Nov 19 '05 #3
hmmm. Do a Find In Files (Ctrl+Shift+F) and search for WebForm1. See if it
find anything you don't see.

"jty202" <jt****@gmail.com> wrote in message
news:uj**************@TK2MSFTNGP14.phx.gbl...
I uploaded the files to my host service in their own directory. I didn't
open this in Visual Studio, I open the file using IE.
"David Jessee" <dj*****@houston.rr.com> wrote in message
news:Oh**************@TK2MSFTNGP15.phx.gbl...
are you running it by wither presing Play or F5? If so, then its not trying
to open up index, its trying to open what was set as the start page for
debugging, which may or may not be the same default document for your wen
site. In the solution explorer, right=click on Index.aspx and select

Set As
Start Page.
"jty202" <jt****@gmail.com> wrote in message
news:O0****************@tk2msftngp13.phx.gbl...
I encounter a problem.

I have three files:
index.aspx
index.aspx.vb
HTMLContentParser.vb (doesn't have the class WebForm1

I put all three file in the same directory.

when I ran index.aspx it has an error

"Could not load type 'HTMLContentParser.WebForm1'"

this is run line 1
Line 1: <%@ Page Language="vb" EnableViewState="false"
AutoEventWireup="false" Codebehind="Index.aspx.vb"
Inherits="HTMLContentParser.WebForm1"%>
This is the code of HTMLContentParser.vb.... Do I need to compile it first
before I upload it? What is my problem?

'''''''''''''''''''''''''''''
Imports System.IO
Imports System.Net
Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Public Class HTMLContentParser
Function Return_HTMLContent(ByVal sURL As String)
Dim sStream As Stream
Dim URLReq As HttpWebRequest
Dim URLRes As HttpWebResponse

Try

URLReq = WebRequest.Create(sURL)
URLRes = URLReq.GetResponse()

sStream = URLRes.GetResponseStream()
Return New StreamReader(sStream).ReadToEnd()

Catch ex As Exception

Return ex.Message

End Try
End Function

Function ParseHTMLLinks(ByVal sHTMLContent As String, ByVal sURL As
String) As ArrayList
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()

rRegEx = New Regex("a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _ RegexOptions.IgnoreCase Or RegexOptions.Compiled)

mMatch = rRegEx.Match(sHTMLContent)

While mMatch.Success
Dim sMatch As String
sMatch = ProcessURL(mMatch.Groups(1).ToString, sURL)
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While

Return aMatch

End Function

Function ParseHTMLImages(ByVal sHTMLContent As String, ByVal sURL As

String)
As ArrayList
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()

rRegEx = New Regex("img.*src\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _ RegexOptions.IgnoreCase Or RegexOptions.Compiled)

mMatch = rRegEx.Match(sHTMLContent)

While mMatch.Success
Dim sMatch As String
sMatch = ProcessURL(mMatch.Groups(1).ToString, sURL)
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While

Return aMatch

End Function

Private Function ProcessURL(ByVal sInput As String, ByVal sURL As

String)

'Find out if the sURL has a "/" after the Domain Name
'If not, give a "/" at the end
'First, check out for any slash after the
'Double Dashes of the http://
'If there is NO slash, then end the sURL string with a SLASH
If InStr(8, sURL, "/") = 0 Then
sURL += "/"
End If

'FILTERING
'Filter down to the Domain Name Directory from the Right
Dim iCount As Integer
For iCount = sURL.Length To 1 Step -1
If Mid(sURL, iCount, 1) = "/" Then
sURL = Left(sURL, iCount)
Exit For
End If
Next
'Filter out the ">" from the Left
For iCount = 1 To sInput.Length
If Mid(sInput, iCount, 4) = "&gt;" Then
sInput = Left(sInput, iCount - 1) 'Stop and Take the Char
before Exit For
End If
Next

'Filter out unnecessary Characters
sInput = sInput.Replace("&lt;", Chr(39))
sInput = sInput.Replace("&gt;", Chr(39))
sInput = sInput.Replace("&quot;", "")
sInput = sInput.Replace("'", "")

If (sInput.IndexOf("http://") < 0) Then
If (Not (sInput.StartsWith("/")) And Not (sURL.EndsWith("/")))

Then Return sURL & "/" & sInput
Else
If (sInput.StartsWith("/")) And (sURL.EndsWith("/")) Then
Return sURL.Substring(0, sURL.Length - 1) + sInput
Else
Return sURL + sInput
End If
End If
Else
Return sInput
End If
End Function
End Class



Nov 19 '05 #4

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

Similar topics

1
by: ofer | last post by:
Hi, I am working with the beta version of the new .net framework (Whidbey) and I encountered a problem with serialization that did'nt exist in the .net 2003 the situation is like this : I have...
1
by: shine | last post by:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="shine.WebForm1" %> what does Inherits means in this tag, what is the use of it plz explain me regards...
4
by: Ben R. | last post by:
Between ClassName and Inherits, which attribute is set to specify the class that a page uses? I would think that would be inherits. Further, the description for ClassName is: Specifies the class...
2
by: ofer | last post by:
Hi, I am working with the beta version of the new .net framework (Whidbey) and I encountered a problem with serialization that did'nt exist in the .net 2003 the situation is like this : I have...
3
by: Binod Nair | last post by:
Hi All, Can somebody tell me what I am doing wrong. I have a Base Abstract Class Public MustInherit Class BaseRequestHandler : Inherits System.Web.UI.Page Protected Overridable Sub...
3
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
2
by: Henri | last post by:
Hi, I'm trying to design a custom LinkButton. It inherits LinkButton as I need the implementation of the Click event (and I don't know how to rewrite it). I have to use AddAttributesToRender to...
7
by: Amirallia | last post by:
Hello! I have a wecontrol table in a page, this table has a number of variable rows depending of the choice of the user. But when the table has a large number of rows, the printing of the page...
0
by: Mohammad Hashemian | last post by:
Hi, I want to write a program that have multi different sections, and in each section I want to use different authentication system. For example, in main page of application, I have three...
1
by: christian.Blackburn | last post by:
Hi Gang, On my development system I am not getting this error, but it does happen when I upload it to my ISP. Can someone tell me why this is happening? I don't have any user-defined controls...
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.