Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1108877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:08:57+00:00 2026-05-17T02:08:57+00:00

I am building a hybrid MVC/Webforms application where my MVC views are using an

  • 0

I am building a hybrid MVC/Webforms application where my MVC views are using an asp.net webforms 2 MasterPage. Everything has been working perfectly until I decided to put a form in my MVC view. Since ASP.NET Webforms wraps the entire page in a form element and you can’t have a form within a form, I’m a little bit stuck.

There are a load of legacy controls in the master page which rely on the post back so I can’t just disable it. The one thought I have at the moment is that all of the controls which rely on the aspnetForm form are above of the MVC page so was wondering if there is anyway to control when asp.net closes the aspnetForm form tag? Or does anyone have any other thoughts about how I could solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:08:58+00:00Added an answer on May 17, 2026 at 2:08 am

    I’ve been here before, and ended up plumping for separate master pages, however:

    Maybe you haven’t looked too closely, but you do have control over where and how that form is wrapped around your entire container

    [Edit]: More complete example:

    <body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder ID="LegacyContentHolder" runat="server">
    
        </asp:ContentPlaceHolder>
    </div>
    </form>
    <asp:ContentPlaceHolder ID="MvcContentPlaceHolder" runat="server">
    
     </asp:ContentPlaceHolder>    
    </body>
    

    Surely you can just move that around the appropriate placeholders for the Webforms stuff, and leave the other placeholders outside the scope of it?

    This generates the following markup if used on a page

    <body>
    <form name="aspnetForm" method="post" action="Test.aspx" id="aspnetForm">
    <div>
     <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"     value="/wEPDwUJNDMyNDU0NjAzZGT01Ocz+ON8w56SI8x7nj2/h8B/4g==" />
     </div>
    
    <div>
    
    
    Web forms behaviour has been generated here, boo
    
    </div>
    </form>
    
    
    MVC content has been generated here, yay
    
    
    </body>
    

    [Edit]

    Note: I’ve checked our code now, had to go back a few versions – what we also did is had three master pages, one for the skeleton described above, one with the specific ASP.NET Webforms stuff, and one inheriting from that for just the MVC stuff.

    Kept things kinda clean, and ready for migrating it away from Webforms in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Building a sample ASP.NET MVC app. Using the Membership API for authentication. For whatever
Building a new ASP.net application, and planning to separate DB, 'service' tier and Web/UI
Building an app using android.support.v4.app , targeting API level 8. Everything's working as planned
Building an ASP.NET MVC3 application at work and I'm trying to use a program
I'm building an hybrid Android App using Phonegap/Apache Cordova. My app should get data
I'm building a hybrid mobile application (PhoneGap+JQM). While testing in the Android emulator, I'm
I'm about to embark on the ASP.net project which involves building a pretty powerful
Building an MVC 2.0 web site and using Content Delivery Network (CDN) in my
Building a simple asp.net web app just to test things out (will obviously refactor
Building on what has been written in SO question Best Singleton Implementation In Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.