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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:58:18+00:00 2026-05-27T17:58:18+00:00

Basically we are in a major hacky situation. We have a few web pages

  • 0

Basically we are in a major hacky situation. We have a few web pages that is linked to from an other site. However, the requirement is that this site has the same layout as the site that linked to us. This was originally done by requesting the original page, scraping the layout, and wrapping out content in their layout.

This was rather simple in Web Forms as we could simply create a subclassed Page, that overrides the Render method and then wrapped anything we produced in the external sites layout. However, now this project is being rewritten in ASP.NET MVC.

How can we get acccess to the HTML result created by the MVC actions, modify them according to our needs and output the modified result to the browser?

  • 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-27T17:58:19+00:00Added an answer on May 27, 2026 at 5:58 pm

    After having tried tugberk’s solution which was insufficient I ended up creating a custom view result:

     public class WrappedViewResult : ViewResult
        {
            private readonly object model;
            public WrapInDtuViewResult()
            {
    
            }
    
            public WrapInDtuViewResult(object model)
            {
                this.model = model;
            }
    
    
            public override void ExecuteResult(ControllerContext context)
            {
    
                if (string.IsNullOrWhiteSpace(this.ViewName))
                {
                    this.ViewName = context.RouteData.Values["action"].ToString();
                }
                ViewEngineResult result = this.FindView(context);
    
                context.Controller.ViewData.Model = model;
                ViewDataDictionary viewData = context.Controller.ViewData;
                TempDataDictionary tempData = context.Controller.TempData;
    
                var writer = new StringWriter();
                ViewContext viewContext = new ViewContext(context, result.View, viewData, tempData, writer);
                result.View.Render(viewContext, writer);
    
    
                var content = writer.ToString();
    
    
                Scraping scraping = new Scraping();
                if (AppSettings.UseScraping)
                {
                    content = scraping.Render(content);
                }
                else
                {
                    content = "<html><head><script src='/Scripts/jquery-1.7.1.min.js' type='text/javascript'></script></head><body>" + content + "</body></html>";
                }
    
                context.HttpContext.Response.Write(content);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I am trying to restart a service from a php web page. Here
I have an installer that I would like to use for a major upgrade.
I am a Web developer and in my projects I have noticed that my
I have a word-wrap algorithm that basically generates lines of text that fit the
Im having some major problems with an site im developing, basically whats happening is
I have a major problem. We have a asp.net application that has this report
I'm putting together my deployment plan for a major deployment next week (basically taking
Basically I have some code to check a specific directory to see if an
Basically I'm going to go a bit broad here and ask a few questions
Basically I’ve heard that certain conditions will cause .NET to blow past the finally

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.