.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

modification in class shows namespace error

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net

hi all,

this code i copied from http://www.csharp-station.com/Tutorials/Lesson07.aspx

using System;

class Address
    public string name;
    public string address;

  class MethodParams
    public static void Main()
        string myChoice;

        MethodParams mp = new MethodParams();

            // show menu and get input from user
            myChoice = mp.getChoice();

            // Make a decision based on the user's choice

            // Pause to allow the user to see the results
            Console.Write("press Enter key to continue...");

View Complete Post

More Related Resource Links

Error trying to extend a class, The type or namespace name 'ErrorData' does not exist in the names


I would like to create a class that extends my ErrorData class, i have not done this in a while and when i try    class ErrorDataASPX : ExceptionHandler.ErrorData and build i get msg:

Error 1 The type or namespace name 'ErrorData' does not exist in the namespace 'ExceptionHandler' (are you missing an assembly reference?) C:\ExceptionHandling\ExceptionHandler\ErrorDataASPX.cs 9 44 ExceptionHandler

namespace ExceptionHandler
    class ErrorDataASPX : ExceptionHandler.ErrorData

namespace ExceptionHandling
    using System;
    using System.Globalization;
    using System.Text;
    using System.Web;

    /// <summary>
    /// Contains information about an error.
    /// </summary>
    public class ErrorData

Type or namespace error.


A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 

Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

error message that would typically be received when the dll has not been added as a reference or added in a using statement.

I can eliminate the error by adding an


Class Templates: Bring the Power of Templates to Your .NET Applications with the CodeDOM Namespace


In the .NET Framework, the CodeDOM object model can represent code in a variety of languages. This article examines how source code templates written with the Framework's System.CodeDom and System.CodeDom.Compiler namespaces allow developers to create reusable boilerplate source code that can be shared between projects. Components designed via templates improve productivity and shorten development time.Here C++-style classes and templates are simulated and code is generated in multiple languages through the creation of CodeDOM object graphs. Compiling object graphs and formatting output code are also explained.

Adam J. Steinert

MSDN Magazine February 2003

How do I find the file path from a namespace.class name?


I'm programatically looking ito a .aspx file and getting the file class name declared in its CodeBehind. For example, when analyzing myFile.aspx I read in its Page Directive and found its CodeBehind equals "myApplication\myPage.aspx.vb". Then I use the code below:


Dim Assm As System.Reflection.Assembly = System.Reflection.Assembly.LoadFrom("myApplication\bin\myApplication.dll")
Dim ClassType As Type = Assm.GetType("myApplication\myPage.aspx.vb")
' myBaseType = "myApplication.Forms.BasePage"
Dim myBaseType As System.Type = ClassType.BaseType


Now I want to read the BaseFile (class = myApplication.Forms.BasePage). However, to read in this file, I need I need to get its full path instead of its namespace.class hiearchy. In this case, the BasePage is wrapped in a different namespace declaration thus I cannot just change the '.' to '\' in order to get the path.

How can I get the path of BasePage so I can read it? Thank you - Frank

Error Consuming Web Service - Unable to import binding xxx from namespace ...


In VS2008 / C# / ASP.NET 3.5, I wrote a test web service app. Here is an extract from the code:

namespace emed.MathWebService
    /// <summary>
    /// Sample Math Services For Learning Web Services Deployment
    /// </summary>
    [WebService(Namespace = " http://localhost/MathService")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class MathService
        public float Add(float a, float b)
            return a + b;


I have published this to an IIS virtual directory named MathService, and when I try to launch it with the URL http://localhost/mathservice/MathService.asmx is works fine and displays all the operations (Add, Subtract etc) in the service.

I then created a test web application in VS2008 (named WebSvcTe

override of base class error please help!!!


i would really like to override http keepalives for my webservice and i found some source code that seems promising but i get an error that says

"function GetWebRequest" Cannot be declared override. 


    Protected Overrides Function GetWebRequest(ByVal uri As Uri) As WebRequest
        Dim webRequest = DirectCast(MyBase.GetWebRequest(uri), HttpWebRequest)
        webRequest.KeepAlive = False
        Return webRequest
    End Function

how do i implement this into my serivice and why im i getting this error??? in other words what in hell is the uri that i should be passing into this function.

Any assictance would be greatly appreciated.


syntax error in calling mailhelper class??


I use to program with VB.NEt. I am just learning C#.  I need to learn C# b/c I am a SharePoint developer and Admin and thats what SharePoint is coded from.


so I am trying to create a simple form that sends an email but am getting an error with calling this function:

       mailHelper.SendMailMessage("admin@pointeightpower.com", "jstevens@pointeightpower.com", null, null, "August Heat Stress", String.Concat(txtSupervisorName.Text.Trim, "reviewed this month's training on ", System.DateTime.Now));


it says param string has some invalid arguements. I dont know why. it works in VB.Net. any help? Thanks

Error Build: Type or namespace could not be found, when referencing a web service

Hello, I'm new in writing C# application in Visual Studio 2008. I'm currently writing a web application for CRM 4.0 Reporting Service rendering. I reference my web application to our Reporting Service web service http://reportservername /ReportServer/ReportExecution2005.asmx and name it 'RSWebReference'. Then I want to reference it in my code: Using RSWebReference; Not sure why, but I cannot build my solution, saying "The type or namespace name 'RSWebReference' could not be found (are you missing a using directive or an assembly reference?)". I read this thread in http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/74f70e30-83e8-4817-b5e0-7729450730a1 that the website probably is using .net 1.1, and I should change it to .net 2.0. However, I think the website is already using 2.0. Is it probably because I'm using VS 2008? How can I tell and change if the website is using 1.1 or 2.0? Or could I be doing something wrong? Thanks in advanced for your help! -Elizabeth K.

LINQ to SQL compiler error CS1519: Invalid token 'void' in class, struct, or interface member decl

I get the following compiler errors when creating my first LINQ to SQL class (I just dragged a table "ProfileExtended" onto the designer and hit build):DataClasses.designer.cs(31,11): error CS1519: Invalid token 'void' in class, struct, or interface member declaration these are the offending lines of autogenerated code:#region Extensibility Method Definitions  partial void OnCreated();  partial void InsertProfileExtended(ProfileExtended instance);  partial void UpdateProfileExtended(ProfileExtended instance);  partial void DeleteProfileExtended(ProfileExtended instance);  #endregion

class names and namespace behaviour

This is something that I'm not sure if it's a problem or something I have configured wrong. Just thinking on it is making my head hurt!! So here goes. What I'm doing...   1. create a blank VS2010 web project called "MySite" targeted at 4.0 2. create a new class object, calling it "class1.vb" (cause it's so unique!!) 3. change default code to read as such...Namespace MySite Public Class Functions Public Shared Function WhatIsTodaysDate() As String Return Date.Now.ToLongDateString End Function End Class End Namespace 4. create a new webform and drop a label control on it. In the page_load event, I want to set the label to equal the value of Function WhatIsTodaysDate. Simple enough, but now comes the part that escapse me. I can do this...Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Label1.Text = MySite.Functions.WhatIsTodaysDate() End Sub but if I want to shorten my code, and call the function using an "Imports" tag i have to do this...Imports MySite.MySite.Functions Public Class WebForm1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Label1.Text = WhatIsTodaysDate() End Sub End Class Why is VS asking me to call the namespa

MasterType TypeName Namespace Error

Hello, I'm trying to use a MasterType TypeName to access a class with master pages.  This works when I'm using .NET 2.0, VS 2005, and C#.  When I try this using .NET 3.5, VS 2008 and C# I get the error: The type or namespace name 'classA' could not be found (are you missing a using directive or an assembly reference?) and it is pointing to the Default.aspx.designer.cs In the default.aspx I have: <%@ Page Language="C#" MasterPageFile="... <%@ MasterType TypeName="classA" %> I have added a folder App_Code to my project and in that folder I have a class file "classA.cs" that contains: Using ... Namespace Project.App_Code {     public class classA : System.Web.UI.MasterPage ... The main difference that I see from where it works and where it doesn't work is that where it doesn't work it uses the namespace called Project. So I figure my problem is in the including the class classA in the namespace or properly including the namespace and / or App_Code directory in the MasterType TypeName which I don't seem to be able to figure out. Does anyone know what I may be doing wrong? Thanks, ron  

Error on VS 2008 Class Library project: are you missing an assembly reference?)

http://msdn.microsoft.com/en-us/library/bb153523(office.12).aspx Working with ASP.NET 2.0 Web Parts and Windows SharePoint Services 3.0 Based on the above MSDN Walkthrough, I created a Class Library VS 2008 project. When clicking the Build menu, 11 errors on System.Web.Security etc popped up.  What's wrong? *********************************************** using   System; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; Error 1 The type or namespace name 'Security' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) Error 2 The type or namespace name 'UI' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

Report Viewer Webpart shows error

Hi Friends, I am Report Viewer Webpart in sharepoint 2010 when i provide the report1.rdl to this webpart it shows the error "SQL extension is not registerd on this web application" any help would be appreciated  

How can I access a webform control from another external class/namespace?


Currently, I have many controls and objects such as Chart1 of mschart as part of the public partial class _Default : System.Web.UI.Page.

At the bottom, I've created a second class that is not part of the _Default webform class.  How can I access the webform controls from this second class?

For example, I want to do

Chart1.Series["Series1"].Points.AddXY((pointIndex + 1) * 40, datapoints[pointIndex]);

I want to pass pointIndex integer and the datapoints array.

I know that Chart1 was created protected global access modifier in the designer.cs but when I changed it to public, it still had a problem.


Getting error "The XML element 'EnableTheming' from namespace...." When running Web service


Hi everybody i am getting an error

The XML element 'EnableTheming' from namespace 'http://tempuri.org/' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element.

when i am running my webservice There is no error at build time its build up successfully.

I an getting this error when i return an asp.net pannel from my web method.. but when i am returning simple string its work fine..

Thnks in advance,


Maximum Request length Exceeded Error - web.config modification does not fix


I am running into the Maximum Request length exceeded error on one of my SSRS reports - SQL Server 2005 SP2.  I modified my web.config file as described in this and other threads:


I restarted all services (IIS, Reporting services) and while it fixes the problem with the parameter, I am getting other errors that are preventing the report from rendering as expected. For example, I have a document map in the report which no longer displays, and expand/collapse capability in the report doesn't work.  Any other ideas for fixing this issue? 

Error:Retrieving the COM class factory for component with CLSID {} failed due to the following error

  I am trying to take screenshots of any open Internet Explorer. I have writen the code and it works fine when I run the site in debug mode.
  Once the site is published I get the following error:

Retrieving the COM class factory for component with CLSID {9BA05972-F6A8-11CF-A442-00A0C90A8F39} failed due to the following error: 8007000e.

This error is shown for the following line:
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();

I have given permission to various files for aspnet user.

I have looked up most of the forum but to no avail.

Any help would be greatly appreciated.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend