cs0236 error from server

Results 1 to 2 of 2

Thread: cs0236 error from server

  1. #1
    Join Date
    Dec 1969

    Default cs0236 error from server

    I&#039;m currently in an ASP.net class at our junior college. We are having a problem with the implementation of a user control involving code behind.<BR><BR>My code runs fine in the local PC, but when I put it on our student server, I get CS0246: The type or namespace name &#039;fdMenuHeader&#039; could not be found (are you missing a using directive or an assembly reference?)<BR><BR>Essentially I have a user control file myUser.ascx along with the codebehind for that file: myUser.ascx.cs. I also have a web page file: myWebform.aspx with its codebehind file: myWebform.aspx.cs.<BR><BR>I want to maintain the codebehind separation and I think this should work just fine. I have read references indicating that I may have to manually compile my user control, then send it separately to the server. If so, I do not understand why we have to manually compile our code as long as the user control is already a part of our project. Doesn&#039;t the compiler grab all the resources is needs at compile time. Also, doesn&#039;t the server compile the information at runtime? If so, what good does it do us, to manually compile and create a dll prior to posting our files to a server??<BR><BR>I can post the files or send them directly to anyone who may have an answer.<BR><BR>Thanks!!!

  2. #2
    Join Date
    Dec 1969

    Default solutions

    Assembly references not found happens when the class cannot be loaded from your /bin folder or found in the .cs codebehind.<BR><BR>Some servers require you to precompile the codebehind because of the n-tier environment. The benefit is performance. Since the file is already compiled it doesn&#039;t need to do it at runtime. It&#039;s not a big improvement since it&#039;s compiled on first request anyways, but sometimes for purpose of code obfuscation it proves helpful. You can find an easy to use visual c# compiler at www.retrofusion.cc/rapidfire.<BR><BR>Now, your error occurs because: <BR><BR>a.) You are referencing a class within your code that is not referenced with a; using [namespace.namespace.etc] or, the assembly that contains the class is not in your /bin folder on the server. THE BIN MUST BE IN THE ROOT.<BR><BR>b.) If the server required a precompile the error would be different, (referencing an error in web.config or the gac [general assembly cache]) At least this has been my experience. <BR><BR>fdMenuHeader I&#039;m assuming is a .ascx file you made. Is this located on the remote offending server? Is its path referenced properly for the new environment? <BR><BR>If it&#039;s not in fact a .ascx page and is a class within one of your codebehind pages, is the codebehind referenced properly in the .aspx page for the new environment? <BR><BR>Lastly, did you make this project in Visual Studio? (if this is the case then I cannot help, I don&#039;t use Visual Studio, only a text editor) <BR><BR>You can send the files to me at Kevin.Mesiab@hp.com and I will take a look if you&#039;ve not found the solution.<BR><BR>-Kevin Mesiab

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts