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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:30:10+00:00 2026-05-23T03:30:10+00:00

We have a server control that we want to use in our .net MVC

  • 0

We have a server control that we want to use in our .net MVC application. The control will only be a part of the page and I would like to not refactor the whole application (including layout pages) to get this one page to work. So I believe my choices to be as follows.

  • Just put everything on an aspx page, and use routing to go there, losing my layout pages
  • Use an iframe (lame)
  • Use HttpContext.Current.Server.Execute(url) (throws error)
  • Use an http request to get the html and then shove it on the page, better than an iframe

So idealy I would like to use HttpContext.Current.Server.Execute to execute the url, return the html and do that all server side. I just keep getting an error thrown. The page is accessible from a browser, but the routing is taking affect sometimes and then I just get a “Child request failed”.

Thoughts? Please also don’t say this is a bad idea, I already know that. I’m just trying to make the best of a bad situation.

Thanks.

  • 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-23T03:30:10+00:00Added an answer on May 23, 2026 at 3:30 am

    I ended up having my asp.net web form page grab the MVC view, and find out where to put it’s content. It’s backwards that way but works and the postbacks work as well. This was done for a Razor engine with an Action and view, not a partial view.

    var controller = new CalendarController();
    var routeData = new System.Web.Routing.RouteData();
    routeData.Values.Add("controller", "CalendarController");
    controller.ControllerContext = new ControllerContext(new FakeHttpContext(), routeData, controller);
    try
    {
        using (StringWriter sw = new StringWriter())
        {
             var  viewResult = controller.Index() as ViewResult;
              var view = ViewEngines.Engines.FindView(controller.ControllerContext, "relative_pathto_view", "");
             ViewContext viewContext = new ViewContext(controller.ControllerContext, view.View,             controller.ViewData, controller.TempData, sw);
             view.View.Render(viewContext, sw);
             var page = sw.GetStringBuilder().ToString();
        }
    }
    catch (Exception ex)
    {
        Response.Write(ex.ToString());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a master page that contains an ASP.NET server side Menu control (System.Web.UI.WebControls.Menu)
I want to read UTF-8 strings from a server that I have control of,
Using ASP.Net, I have a server control for which i would like to add
Is there a way that I can have a server control MyControl<T> so that
I currently have a control that is being hidden on my server side using
I have a server that I have no control over, it's JSON based and
Usage scenario We have implemented a webservice that our web frontend developers use (via
I have a situation where I want to use several server side controls, which
I have several server controls that implement the IValidator interface. As such, they have
I have custom server control contains templatefield when an out button clicked the field

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.