Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > "'If' must end with a matching 'End If'." <-- BUT IT DOES!! WHY DOESN'TTHE DAMN SERVER SEE IT???

Reply
Thread Tools

"'If' must end with a matching 'End If'." <-- BUT IT DOES!! WHY DOESN'TTHE DAMN SERVER SEE IT???

 
 
Neo Geshel
Guest
Posts: n/a
 
      07-03-2004
It seems that there is somewhere where an IF statement will not nor ever
function inside of an ASP.NET application.


I am using IIS5 on Win2K. I have a web page that uses ASP.NET includes
(an "@ resister" with the "Name:tag"). In the ascx include file I have a
Sub Page_Load that contains an IF statement. I need the Sub Page_Load to
exist inside the ascx file, because its results will be written to
another part of the ascx's contents.

It seems that the IF statement is incapable of functioning, as the
server is claiming that the IF statement has no matching "End If", when
in fact it does. I am using the following code:
If ((Request.Browser.Platform = "WinNT") And
(Request.Browser.Browser = "IE") And (Request.Browser.MajorVersion =
"6")) Then
strBrowserDetect = " <object id=""CTAdjust""
codeBase=""http://www.microsoft.com/typography/clearadj.cab#version=1,0,0,1""

classid=""CLSIDE22A7AB-A739-4C58-AD52-21F9CD6306B7""
VIEWASTEXT></object>" & vbCrLf & " <script type=""text/javascript""
src=""/js/cleartype.js""></script>" & VbCrLf
End If

It produces the following error message:

Compiler Error Message: BC30081: 'If' must end with a matching 'End If'.

Source Error:

Line 14: If ((Request.Browser.Platform = "WinNT") And
(Request.Browser.Browser = "IE") And (Request.Browser.MajorVersion =
"6")) Then
Line 15: strBrowserDetect = " <object id=""CTAdjust""
codeBase=""http://www.microsoft.com/typography/clearadj.cab#version=1,0,0,1""

classid=""CLSIDE22A7AB-A739-4C58-AD52-21F9CD6306B7""
VIEWASTEXT></object>" & vbCrLf & " <script type=""text/javascript""
src=""/js/cleartype.js""></script>" & VbCrLf
Line 16: End If

Source File: C:\Inetpub\Web Sites\Prairie West Wood
Products\www\ssi\head.ascx Line: 14


When I strip everything out of the IF statement, and put the following
in the Sub:
If Request.Browser.Platform = "WinNT" Then
End If

I get the following very bizarre error message:

Compiler Error Message: BC30289: Statement cannot appear within a
method body. End of method assumed.

Source Error:

Line 61: #End ExternalSource
Line 62:
Line 63: Public Sub New()
Line 64: MyBase.New
Line 65: If (ASP.head_ascx.__initialized = false) Then

Source File: C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Tempora ry
ASP.NET Files\root\b8f35e90\23891c34\7ycfnybt.0.vb Line: 63



COULD SOMEONE PLEASE TELL ME JUST WHAT THE **** IS GOING ON HERE??

TIA
....Geshel
--
************************************************** ********************
My reply-to is an automatically monitored spam honeypot. Do not use it
unless you want to be blacklisted by SpamCop. Please reply to my first
name at my last name dot org.
************************************************** ********************
 
Reply With Quote
 
 
 
 
hamking
Guest
Posts: n/a
 
      07-21-2004
Neo Geshel <> wrote in message news:<W3oFc.939308$Pk3.322528@pd7tw1no>...
> It seems that there is somewhere where an IF statement will not nor ever
> function inside of an ASP.NET application.
>
>
> I am using IIS5 on Win2K. I have a web page that uses ASP.NET includes
> (an "@ resister" with the "Name:tag"). In the ascx include file I have a
> Sub Page_Load that contains an IF statement. I need the Sub Page_Load to
> exist inside the ascx file, because its results will be written to
> another part of the ascx's contents.
>
> It seems that the IF statement is incapable of functioning, as the
> server is claiming that the IF statement has no matching "End If", when
> in fact it does. I am using the following code:
> If ((Request.Browser.Platform = "WinNT") And
> (Request.Browser.Browser = "IE") And (Request.Browser.MajorVersion =
> "6")) Then
> strBrowserDetect = " <object id=""CTAdjust""
> codeBase=""http://www.microsoft.com/typography/clearadj.cab#version=1,0,0,1""
>
> classid=""CLSIDE22A7AB-A739-4C58-AD52-21F9CD6306B7""
> VIEWASTEXT></object>" & vbCrLf & " <script type=""text/javascript""
> src=""/js/cleartype.js""></script>" & VbCrLf
> End If
>
> It produces the following error message:
>
> Compiler Error Message: BC30081: 'If' must end with a matching 'End If'.
>
> Source Error:
>
> Line 14: If ((Request.Browser.Platform = "WinNT") And
> (Request.Browser.Browser = "IE") And (Request.Browser.MajorVersion =
> "6")) Then
> Line 15: strBrowserDetect = " <object id=""CTAdjust""
> codeBase=""http://www.microsoft.com/typography/clearadj.cab#version=1,0,0,1""
>
> classid=""CLSIDE22A7AB-A739-4C58-AD52-21F9CD6306B7""
> VIEWASTEXT></object>" & vbCrLf & " <script type=""text/javascript""
> src=""/js/cleartype.js""></script>" & VbCrLf
> Line 16: End If
>
> Source File: C:\Inetpub\Web Sites\Prairie West Wood
> Products\www\ssi\head.ascx Line: 14
>
>
> When I strip everything out of the IF statement, and put the following
> in the Sub:
> If Request.Browser.Platform = "WinNT" Then
> End If
>
> I get the following very bizarre error message:
>
> Compiler Error Message: BC30289: Statement cannot appear within a
> method body. End of method assumed.
>
> Source Error:
>
> Line 61: #End ExternalSource
> Line 62:
> Line 63: Public Sub New()
> Line 64: MyBase.New
> Line 65: If (ASP.head_ascx.__initialized = false) Then
>
> Source File: C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Tempora ry
> ASP.NET Files\root\b8f35e90\23891c34\7ycfnybt.0.vb Line: 63
>
>
>
> COULD SOMEONE PLEASE TELL ME JUST WHAT THE **** IS GOING ON HERE??
>
> TIA
> ...Geshel


I just had the same problem. For me it was cause I forgot to put the "End Sub"
My if ... end if... worked
 
Reply With Quote
 
 
 
 
Versteijn
Guest
Posts: n/a
 
      08-18-2004
> I just had the same problem. For me it was cause I forgot to put the "End Sub"
> My if ... end if... worked



In my case (conversion from old asp to new asp.net page) there was an
old </form> tag in the middle of the page. I used inline script, and
some script was not 'found' or compiled or whatever until I removed
this thing.

If this was really the cause of this problem, why doesn't the compiler
check this and display a more useful error message. It took me almost
1 day :S

Good luck,
Regards,

Freek Versteijn
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: "But..but...but...I can see Russia from my porch!" mrLookout@sewage.com Computer Support 0 04-15-2010 12:02 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
End of trial period......DAMN!! Please Help =?Utf-8?B?SmltbXkgTGFtICJQbGVhc2UgSGVscCI=?= Windows 64bit 13 05-06-2006 01:05 AM
BC30081: 'If' must end with a matching 'End If'. William ASP .Net 2 06-01-2005 08:37 PM
"'If' must end with a matching 'End If'." Neo Geshel ASP General 0 07-03-2004 01:06 AM



Advertisments