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 8680551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:16:48+00:00 2026-06-12T21:16:48+00:00

I’m working on MVC project and I have to use web forms control there.

  • 0

I’m working on MVC project and I have to use web forms control there. I can include whole page in iframe in my mvc project view that’s not a problem. That kind of behavior is acceptable.
But I have a problem with data I need to exchange. I want to send some data from the controller there and also get some response after control end its work. To be more specific:

1. Send some initial values to the web control from controller on start.

2. Something like “magic” button in web forms when it’s clicked I have post back to the controller with some data generated by the control.

Is this even possible?

  • 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-06-12T21:16:50+00:00Added an answer on June 12, 2026 at 9:16 pm

    This certainly is possible. You could use an iframe to host the legacy WebForm inside the ASP.NET MVC application. Let’s suppose for example that you have the following ASP.NET MVC controller:

    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.ValueFromMvc = "this value is coming from MVC";
            return View();
        }
    
        public ActionResult Back(string valueFromWebForms)
        {
            return Content(string.Format("This value came from WebForms: {0}", valueFromWebForms));
        }
    }
    

    with the corresponding ~/Views/Home/Index.cshtml view:

    <iframe src="@Url.Content("~/webform1.aspx?value_from_mvc=") + @Url.Encode(ViewBag.ValueFromMvc)"></iframe>
    

    and the following ~/WebForm1.aspx:

    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                label.Text = Request["value_from_mvc"];
            }
        }
    
        protected void Link_Click(object sender, EventArgs e)
        {
            var httpContext = new HttpContextWrapper(Context);
            var requestContext = new RequestContext(httpContext, new RouteData());
            var urlHelper = new UrlHelper(requestContext, RouteTable.Routes);
            Response.Redirect(
                urlHelper.Action(
                    "Back", 
                    "Home", 
                    new { valuefromwebforms = "coming from WebForm1.aspx" }
                )
            );
        }
    </script>
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:Label ID="label" runat="server" />
            <br/>
            <asp:LinkButton 
                runat="server" 
                ID="link" 
                OnClick="Link_Click"
                OnClientClick="document.forms[0].target='_top';"
                Text="Click here to send a value back" 
            />
        </form>
    </body>
    </html>
    

    In this example I supposed that the WebForm is part of the MVC application which allows us to use helpers to generate the links between them. Of course if this is not the case you must use absolute urls to link between the 2 applications.

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

Sidebar

Related Questions

I am working on a MVC project that is supposed to have one page
background:Me and my coworkers are working on asp.net mvc project ... we have a
I have a MVC 4 project I am currently working on and need some
I have a project I'm working on and I'm using the Telerik MVC controls.
I'm working on an editor page for a project in ASP.NET MVC. I would
I am working on a MVC project where I have copied a lot of
I have .NET MVC 3 project where I use sql membership provider and entity
I've been working on a java web project. Currently this project doesnt use any
I'm wanting to use DB4o on an asp.net MVC project i'm working on but
I'm working on asp.net MVC 3 form. I made sure to have the recaptcha.dll,system.web.helpers

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.