1

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.

4
  • 1
    Why are you trying to do this - might help to know. Commented Dec 17, 2009 at 16:32
  • 2
    why on Earth would you want to do that? Have you run out of winforms apps to port back to VB6? Commented Dec 17, 2009 at 16:42
  • In all honesty, I've had extreme difficulty getting the MVC app to deploy on IIS6. I've followed Phil Haack's deployment steps to the T. Thus, since my app isn't fully developed, my thought was to switch to webforms in order to clear this deployment issue. Commented Dec 17, 2009 at 16:53
  • 3
    Maybe your question should be about your problems setting up MVC in IIS6 and not about converting to webforms!? Commented Dec 17, 2009 at 17:41

3 Answers 3

6

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.

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

Comments

1

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

0

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:

enter image description here

http://www.davepaquette.com/archive/2013/12/30/so-you-inherited-an-asp-net-web-forms-application.aspx

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.