views:

90

answers:

2

Hi

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

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="_Default" %>

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  A: 

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.

Dennis Palmer
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?
ElliotC
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?
Dennis Palmer
+1  A: 

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.

Ryan Emerle