tags:

views:

73

answers:

4

I got the following code frfom the web and was trying to compile and run. Its an ajax application. I couldn't get it to compile/build this application; because it says - "Are you missing a using directive or assembly reference" - Can somebody advise what/where should I check? Pardon my ignorance, I'm novice at the Ajx stuff :(

Here is the code from AjaxCopntroller.cs; and the Controller word is underlined in .Net:

namespace System.Web.Mvc {

    public class AjaxController : Controller {

        private bool _isAjaxRequest;

        protected internal virtual bool IsAjaxRequest {
            get {
                return _isAjaxRequest;
            }
        }
    }
}
+1  A: 

Check that the project has a reference to the System.Web.Extensions assembly.

Serguei
A: 

Yes, actualy it does. Previously there was an error and System.Web.Extensions had exclamation mark under references. I resolved that by removing that one and adding the reference to System.Web.Extensions again, using add references.

The Controller word is underlined by the compiler and that's what is not being recognized as the class :(

Thanks for your input, please advise what else I can do.

A: 

I'm a C# programmer but haven't used .NET, but I think it's very strange you're declaring a class in the System.Web.Mvc namespace. I did some research and it looks like you're trying to compile a bit of code which is probably unhelpful. AjaxController looks like it's a class provided by Microsoft, so you don't need to code it yourself, you just need to use it. How do you do that exactly, I don't know, but I think you're heading down the wrong path at the moment.

Ray Hidayat
A: 

The class System.Web.Mvc.Controller is part of the new ASP.NET MVC. You can learn more about it from http://www.asp.net/mvc and download ASP.NET MVC Release Candidate 1 from here.

Eric Weilnau