SidC SidC - 26 days ago 11
ASP.NET (C#) Question

Is it Possible to Convert ASP.net MVC Web Project to ASP.net Web Forms?

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.

Joe Joe
Answer

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.

Comments