By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

problem with Inherits attribute

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.