SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Location
    Washington D.C
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Set http response = to an html file

    Does anybody know how to sent the response of a page to output the contents of an html page? I've tried response.redirect yet this was not the desired result as the URL changed. I also checked out response.writeFile that seem to work yet noticed the contents of the desired page did not show up in the DOM. Any suggestions? Streaming the contents of the other html file seems like it would work but just wanted to know if there was built in method I could take advantage of.

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,629
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Well, you could just serve the file. But failing that, you can get it into the output stream by doing something like:

    Code:
    string html=File.ReadAllText(Server.MapPath("~/Path/To/My/Html.htm"));
    Response.Write(html);
    Now, dumping raw things in the output stream can muck things up. You probably want to put the html in a literal control.

  3. #3
    SitePoint Member ScepterMT's Avatar
    Join Date
    Feb 2008
    Location
    Leesville, LA
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just use Server.Transfer instead of Response.Redirect and the url won't change.

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,629
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    That is what he is trying--but Server.Transfer does not work outside of the current application.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •