0

Is it possible to create a MVC website without having to create a MVC web application via Visual Studio? Basically I just want it to be a simple website and not to have to recompile it in VS. I want to develop it as a 'Web Site' on a test server and connect with front page extensions in VS express. If I copy the files from a MVC Application, remove the namespace of the project in the files I just get errors:

Default.aspx

Default.aspx.cs

using System.Web; using System.Web.Mvc; using System.Web.UI;

public partial class MyDefaultPage : System.Web.UI.Page { public void Page_Load(object sender, System.EventArgs e) { ....

Parser Error Message: Could not load type '_Default'.

Any ideas much appreciated.

1
  • Thanks everyone. I think I understand why this is happening now. It is not the type in my code snippet - well spotted but that was added accidentally when pasting here on stack overflow. As I'm only working on small sites and my main interest is url routing so I think I'll look at using that independently of mvc. Commented Oct 8, 2009 at 15:00

2 Answers 2

1

ASP.NET MVC controllers are compiled .NET classes. You could edit the source and compile via the command line, but you'll still need to compile the source code in order for it to work.

I've never used front page extensions, but I doubt that they would be helpful when working with ASP.NET MVC.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Dennis. So basically it is not really possible to work in the same way as a standard asp.net app and simply make changes to the files which forces the app to recompile?
I don't know how that would have worked. Was it forcing the app to recompile or were you just using interpreted scripts that didn't need to be compiled?
1

The error you're getting is the result of your code-behind page being named MyDefaultPage, and your @Page directive indicates that it should be _Default.

Changes to the aspx page will trigger recompilation; I haven't tried it with a code-behind though (nor have I tried it with MVC)

Since MVC is designed to enable object-oriented development and unit testing, I don't see it as a good use in this case. You can do simple classic ASP-type development, though.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.