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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:47:39+00:00 2026-05-12T00:47:39+00:00

i am porting over a website from asp. i have one page that i

  • 0

i am porting over a website from asp.

i have one page that i can’t figure out how to migrate it.

The page is dynamic in the sense that it reads in other html pages and sticks the content into the main “container” page. In the middle of the asp page it has sections like below

<%
Dim fso1, f11, ts1, s1  
Const ForReading1 = 1  
Set fso1 = CreateObject("Scripting.FileSystemObject")   
Set ts1 = fso1.OpenTextFile("" & Server.MapPath("newsletters/welcome.html") & "",     ForReading)  
s1 = ts1.ReadAll  
Response.Write s1  
ts1.Close  
set fso1 = nothing  
set f11 = nothing  
set ts1 = nothing  
set s1 = nothing  
%>  

Any suggestions in ASP.net MVC for best way to read in other html pages and stick them into a page view.

  • 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-12T00:47:40+00:00Added an answer on May 12, 2026 at 12:47 am

    I assume that these are HTML fragments, not full pages. You could convert them to partial views — pretty trivial, you just add the correct page directive and rename to .ascx. Then you would use Html.RenderPartial to include the partial in your main view. Another way would be to create your own HtmlHelper extension that works like RenderPartial but simply reads the named file and writes it to the response just like you are currently doing.

    Ex1:

     <% Html.RenderPartial( "welcome.ascx" ); %>
    

    Ex2:

     <% Html.RenderHtml(  Server.MapPath( "newletters/welcome.html" ) ); %>
    

    Note that in the first case the view file needs to live in the Views directory. In the second case, you can reference the file from anywhere that the worker process has read access. You’ll need to create the second method yourself. Perhaps something similar to:

     public static class MyHtmlHelperExtensions
     {
          public static void RenderHtml( this HtmlHelper helper, string path )
          {
               var reader = new StreamReader( path );
               var contents = reader.ReadToEnd();
               helper.ViewContext.HttpContext.Response.Write( contents );
          }
      }
    

    Please note that you’ll have to add error handling.

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

Sidebar

Related Questions

I have a debugger that I am porting over to *bsd from linux. Currently,
I'm porting over some code from one project to another within my company and
I have a few applications that might qualify for porting over to a Linux/Mac
I have some amount of older game code that I am porting over to
So I am porting a legacy application over from coldfusion to asp.net/c#. My problem
I'm new to C++ and am porting over code from Java. I have a
We're a startup and we built a .net website which we are porting over
I am working on porting over a database from a custom MSSQL CMS to
I'm porting over the interpreter for a domain specific language I created from Scala
Porting an application from C# (1.1 framework) to VB.NET (3.5 framework), and I have

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.