Tech Off Thread

7 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Problem with namespaces in ASP.NET

Back to Forum: Tech Off
  • User profile image
    prasannarao

    Hello,

    I constructed a public class with a namespace named 'Data_Squeeze' and saved it in a .cs file and pushed it to App_Code folder of my website

    In one of my webpage's code behind, I referenced the namespace with the 'using' directive, and successfully test-ran the project on my local IIS server.

    However, when I tried it on my university's remote server it failed with the error message : CS0246: The type or namespace name 'Data_Squeeze' could not be found (are you missing a using directive or an assembly reference?)

    I followed some suggestions posted online, like checking for spelling mistakes, proper referencing, etc. But no success as yet.

    I am using MS Visual Studio 2008 with IIS 6.0. I don't have access to set directory settings for my website on the remote server. All I can do is upload my files and run the application.

    Appreciate you recommendations...

    -- Prasanna


  • User profile image
    MasterPi

    I ran into this problem recently, too.

    Make sure the Build action is set to "compile" in properties for the specific code-files or it wont get added to the assembly. I believe if you're using VS 2008, you don't need to place the files in an App_code directory anyway.

  • User profile image
    W3bbo

    Is your website's application root defined properly? Since you say it isn't your webserver you don't have control over the application scope. I'd look into that.

  • User profile image
    prasannarao

    MasterPie said:
    I ran into this problem recently, too.

    Make sure the Build action is set to "compile" in properties for the specific code-files or it wont get added to the assembly. I believe if you're using VS 2008, you don't need to place the files in an App_code directory anyway.
    I verified the Build action for .cs files and they all are set to Compile but still getting the same error.. You are App_Code is no longer necessary..


    "Is your website's application root defined properly? Since you say it isn't your webserver you don't have control over the application scope. I'd look into that"

    -- Can you please elaborate on that?

  • User profile image
    prasannarao

    prasannarao said:
    MasterPie said:
    *snip*
    I verified the Build action for .cs files and they all are set to Compile but still getting the same error.. You are App_Code is no longer necessary..


    "Is your website's application root defined properly? Since you say it isn't your webserver you don't have control over the application scope. I'd look into that"

    -- Can you please elaborate on that?
    Also, it seems that my folder is not configured to be "application" on the remote server.. Is that the problem?In IIS we have the option of setting a virtual directory to "application"  which we normally do if the directory was created manually...

    My premises is based on the following error message which I got while trying to run the app on remote serve --

    Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

    Source Error <In web.config>:
    <authentication mode="Windows"/>


    --

  • User profile image
    pierlove

    prasannarao said:
    prasannarao said:
    *snip*
    Also, it seems that my folder is not configured to be "application" on the remote server.. Is that the problem?In IIS we have the option of setting a virtual directory to "application"  which we normally do if the directory was created manually...

    My premises is based on the following error message which I got while trying to run the app on remote serve --

    Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

    Source Error <In web.config>:
    <authentication mode="Windows"/>


    --
    If a folder is not configured in IIS to an application then there is no run time compilation and your code is not creating an assembly to reference. <- This is most likely your issue.

    Another thing to check although I do not believe this is going to be related is to make sure your Target Server .net Framework version is the same as your project.

    -James

    www.dotnetisv.com    

  • User profile image
    W3bbo

    dotnetisv said:
    prasannarao said:
    *snip*
    If a folder is not configured in IIS to an application then there is no run time compilation and your code is not creating an assembly to reference. <- This is most likely your issue.

    Another thing to check although I do not believe this is going to be related is to make sure your Target Server .net Framework version is the same as your project.

    -James

    www.dotnetisv.com    
    Runtime compilation does happen, the root of every website it defined as an application; it's just that ASP.NET expects your bin and App_* directories to be elsewhere.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.