-
Jun 3rd, 2017, 07:15 AM
#1
Thread Starter
Lively Member
[RESOLVED] Where to look to Debug a Web Application?
While half way entering the code for a sample Web project, I did something to cause the error messages below. What puzzles me is the line numbers in the errors -1, 104, 105; none of these numbered line are appear in the provided code below nor any of the ancillary files. How/Where to look for correction? TIA JP
Code:
' Project: CH 9 HandsOn
' Programmer: Bradley/Millspaugh
' Date: Jun 2010
' Description: A Web site to calculate the extended price for books sold,
' at discount, and the discounted amount. Calculates and displaysthe total discounts.
' Uses validator controls for input validation.
' Folder Ch09HansOn
' Exercise: From "Programming in Visual Basic 2010" by Julia C. Bradley & Anita C. Millspaugh
' On page 286 - 393.
'
Partial Class Default_aspx
Inherits System.Web.UI.Page
Private DiscountTotalDecimal As Decimal
Const DISCOUNT_RATE_DECIMAL As Decimal = 0.15D
Protected Sub ClearButton_Click(sender As Object, e As EventArgs) Handles ClearButton.Click
' Clear previous amounts from the page.
QuantityTextBox.Text = ""
TitleTextBox.Text = ""
PriceTextBox.Text = ""
ExtendedPriceTextBox.Text = ""
DiscountTextBox.Text = ""
DiscountTotalHiddenLabel.Text = ""
DiscountTotalLabel.Text = ""
ErrorMessageLabel.Text = ""
End Sub
Protected Sub SummaryButton_Click(sender As Object, e As EventArgs) Handles SummaryButton.Click
' Displaythe total discount.
' DiscountTotalLabel.Text = "Total Discounts: $" & DiscountTotalHiddenField.Value
DiscountTotalLabel.Text = "Total Discounts: $" & DiscountTotalDecimal.ToString
End Sub
End Class
}
Severity Code Description Project File Line Suppression State
Error BC30456 'Context' is not a member of 'my_project_default_aspx'. 1_My Project_Default.aspx d:\documents\visual studio 2017\Projects for the Web\Chapter 9 HandsOn\Chapter 9 HandsOn\My Project\Default.aspx 1 Active
Error BC30456 'Context' is not a member of 'my_project_default_aspx'. 1_My Project_Default.aspx d:\documents\visual studio 2017\Projects for the Web\Chapter 9 HandsOn\Chapter 9 HandsOn\My Project\Default.aspx 1 Active
Warning Another object on this page already uses ID 'errormessagelabel'. Chapter 9 HandsOn d:\documents\visual studio 2017\Projects for the Web\Chapter 9 HandsOn\Chapter 9 HandsOn\My Project\Default.aspx 104
Warning Another object on this page already uses ID 'ErrorMessageLabel'. Chapter 9 HandsOn d:\documents\visual studio 2017\Projects for the Web\Chapter 9 HandsOn\Chapter 9 HandsOn\My Project\Default.aspx 105
-
Jun 5th, 2017, 09:48 AM
#2
Re: Where to look to Debug a Web Application?
The error is occuring in another section of your code.
Code:
Error BC30456 'Context' is not a member of 'my_project_default_aspx'.
Context isn't being declared whatever it may be. When you run does it highlight this error or does this error occur in studio without running?
The warnings are like errors, but I don't have the rest of the code so I can't give you any more details on the warnings in your exception details.
I would try to post more code specifically if there is anything where it says "Context" as that is where the error is occuring.
Disclaimer: When code is given for example - it is merely a example. •
•
•
Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.
-
Jun 5th, 2017, 10:49 AM
#3
Re: Where to look to Debug a Web Application?
Normally this error usually indicates that the partial class is not named correctly.
Check the Inherits attribute in your .aspx file if the value matches with your .aspx.vb class name.
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
Then your class name should also be _Default.
Code:
Partial Class _Default
Inherits System.Web.UI.Page
End Class
-
Jun 5th, 2017, 11:01 AM
#4
Re: Where to look to Debug a Web Application?
My usual boring signature: Nothing
-
Jun 5th, 2017, 11:05 AM
#5
Re: Where to look to Debug a Web Application?
The reason you get line numbers that don't seem to exist in the file is a side-effect of the magic of how ASP works, I got familiar with this because WPF does similar things.
When the app is compiled, the .aspx file, any code in the HTML, and a lot of auto-generated stuff gets generated by the toolchain. That final file with all the generated/combined code is what ACTUALLY gets built. That means the line numbers you get back only make sense in the context of that file, which may or may not exist in one of the /obj directories. It's usually futile to try and track it down though, because getting an error like this one usually indicates something like what's been posted: VS is saying, "Not all of the files are connected like they should be."
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Jun 5th, 2017, 01:38 PM
#6
Thread Starter
Lively Member
Re: Where to look to Debug a Web Application?
Thanks to all who responded! The code listed above was my first attempt to build a Web Page, albeit a line for line entry of a working example. The error made all variables in the project undeclared, preventing any meaningful debug/run exercise. "Context" is currently a mystery for me to research! Checking the Inherits attribute in my .aspx file if the value matches with your .aspx.vb class name will also be a new adventure! Thanks again for the guidance. JP
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|