locked
Server Error / Parser Error RRS feed

  • Question

  • User-1702370179 posted

    Hi,

    Sorry if this is not in the correct forum as I am new to asp.net forums.

    I am new to ASP.net and wish to learn web application development. I have created an ASP.NET application in Visual Studio 2012 Professional and published it to my website (yes it's windows hosted) and I get a server/parser error that I do not fully understand.

    Server Error in '/' Application.
    
    Parser Error 
      Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 
    
     Parser Error Message: Could not load type 'OscilloscopeFrequencyCalculator._default'.
    
    Source Error: 
    
    
    
    Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="OscilloscopeFrequencyCalculator._default" %>
    Line 2:  
    Line 3:  <!DOCTYPE html>
      
    
     Source File:  /area51/online_ofc/Default.aspx    Line:  1 
    
    
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18447 

    The C# file is:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace OscilloscopeFrequencyCalculator
    {
        public partial class _default : System.Web.UI.Page
        {
            double dFrequency;          //variable to hold frequency
            double dTimePerDivision;    //time per devistion
            double dNumberOfDivisions;  //number of divisions for a cycle
            double dPeriod;             //Time a full cycle takes
    
            protected void Page_Load(object sender, EventArgs e)
            {
                //Sets the background colour of the page
                PageBody.Attributes.Add("bgcolor", "#339966");
            }
    
            protected void btnCalculate_Click(object sender, EventArgs e)
            {
                try
                {
                    //put the values into the variables
                    dTimePerDivision = double.Parse(txtTimePerDivision.Text);
                    dNumberOfDivisions = double.Parse(txtNumberOfDivisions.Text);
    
                    dPeriod = (dNumberOfDivisions * dTimePerDivision);
    
    
                    //conversion for seconds, milliseconds, microseconds and nanoseconds
                    if (rblTime.SelectedIndex == 0)
                    {
                        dTimePerDivision /= 1;
                        txtPeriod.Text = string.Format("{0:0.00}", dPeriod) + " S";
                    }
                    else if (rblTime.SelectedIndex == 1)
                    {
                        dTimePerDivision /= 1000;
                        txtPeriod.Text = string.Format("{0:0.00}", dPeriod) + " mS";
                    }
                    else if (rblTime.SelectedIndex == 2)
                    {
                        dTimePerDivision /= 1000000;
                        txtPeriod.Text = string.Format("{0:0.00}", dPeriod) + " μS";
                    }
                    else if (rblTime.SelectedIndex == 3)
                    {
                        dTimePerDivision /= 1000000000;
                        txtPeriod.Text = string.Format("{0:0.00}", dPeriod) + " nS";
                    }
    
    
                    //calculate the frequency in Hertz, kilohertz and megahertz
                    dFrequency = (1.0 / dTimePerDivision) / dNumberOfDivisions;
    
                    if (rblFrequency.SelectedIndex == 0)
                    {
                        txtFrequency.Text = dFrequency.ToString() + " Hz";
                    }
                    else if (rblFrequency.SelectedIndex == 1)
                    {
                        dFrequency /= 1000;
                        txtFrequency.Text = dFrequency.ToString() + " KHz";
                    }
                    else if (rblFrequency.SelectedIndex == 2)
                    {
                        dFrequency /= 1000000;
                        txtFrequency.Text = dFrequency.ToString() + " MHz";
                    }
                }
                catch (Exception)
                {
                     
                }
            }
    
            protected void btnReset_Click(object sender, EventArgs e)
            {
                //Resets all the selection boxes to there default states
                rblTime.SelectedIndex = 0;
                rblFrequency.SelectedIndex = 0;
                txtTimePerDivision.Text = "";
                txtNumberOfDivisions.Text = "";
                txtFrequency.Text = "";
                txtPeriod.Text = "";
            }
        }
    }

    Can anyone help me please. Cry
     

    Tuesday, July 22, 2014 12:24 PM

Answers

  • User-760709272 posted

    The error is that it can't load your type.  Types are held in assemblies (dll files) so the first thing to check is that whatever you did to publish has put the dlls on the server.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 22, 2014 7:04 PM

All replies

  • User-760709272 posted

    Try publishing it to a local folder, make sure the bin folder is there, then upload all the files that were published.  Or failing that at least check the bin folder and dlls have been uploaded to your site.

    Tuesday, July 22, 2014 12:37 PM
  • User-1702370179 posted

    My website is with GoDaddy.com. My ASP.NET application works fine when I run it within visual studio on my laptop, but not when I publish the files through visual studio or manually to my hosted website.

    I need to understand exactly where the error lies in line 1 of the .aspx file in order to correct the fault.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="OscilloscopeFrequencyCalculator._default" %>
    

    Sorry for being a bit thick, Embarassed

    Tuesday, July 22, 2014 6:45 PM
  • User-760709272 posted

    The error is that it can't load your type.  Types are held in assemblies (dll files) so the first thing to check is that whatever you did to publish has put the dlls on the server.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 22, 2014 7:04 PM
  • User-1454326058 posted

    Hi Simnix,

    Please try to use the whole project file to the host and try again.

    On the other hand, please shorten the namespace name and try again.

    Thanks

    Best Regards

    Wednesday, July 23, 2014 4:57 AM