Good Morning,
Has anyone attempted to convert/migrate an ASP.net MVC web application project to ASP.net web forms? If so, how did you accomplish this?
Thanks, Sid
Clarification/Update: The server is running IIS6 and I've modified global.asax. I followed Phil Haack's instructions on setting up IIS6 for use by MVC. I can now view the site in browser at //localhost/domainname. However, it appears that the CSS file isn't being read as no styling is being applied. I'm able to click links to each of my pages except for Parts which gives me errors.
I'm new to MVC but开发者_如何转开发 not to webforms. My thought was that since I'm having difficulties/frustration implementing the MVC app that I would revert to webforms before I get too deep into the development process.A direct conversion? No.
It would take a lot of analyzation and extra work (figuring out how to work with ViewState, converting Controller logic and Views into WebParts, etc.) to convert a .NET MVC App to Web Forms but it could definitely be done.
Personally...I'd never switch back.
I am running on IIS6 with no issues. Set your routes like this,
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// Classic URL mapping for IIS 6.0
routes.MapRoute(
"Default",
"{controller}.aspx/{action}/{id}",
new { action = "Index", id = "" }
);
routes.MapRoute(
"Root",
"",
new { controller = "Home", action = "Index", id = "" }
);
}
and for the CSS links I code it like this,
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
then for any script tags I use this,
<script src="<%=HttpRuntime.AppDomainAppVirtualPath %>/Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
and it seems to work fine.
It's possible to add an MVC Area to an existing ASP.NET webforms project and slowly port each page from webforms to the MVC pattern manually while keeping the original ASP.NET site working.
Not ideal but handy if you want to keep a huge codebase working while you add new parts in MVC or slowly port parts to the MVC Area as needed:
http://www.davepaquette.com/archive/2013/12/30/so-you-inherited-an-asp-net-web-forms-application.aspx
精彩评论