Results 1 to 6 of 6

Thread: [RESOLVED] Where to look to Debug a Web Application?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    125

    Resolved [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

  2. #2
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,168

    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.

  3. #3
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    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
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Where to look to Debug a Web Application?

    Thread moved to ASP.NET.
    My usual boring signature: Nothing

  5. #5
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    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.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    125

    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
  •  



Click Here to Expand Forum to Full Width