Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. render aspx to string.

render aspx to string.

Scheduled Pinned Locked Moved ASP.NET
sysadminquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Subin Mavunkal
    wrote on last edited by
    #1

    Hi , Is there any way to render an aspx page to string.I used some session variables and server controls in my page.When I render it using WebClient myClient = new WebClient(); string myPageHTML = null; byte[] requestHTML; string currentPageUrl = Request.Url.ToString(); UTF8Encoding utf8 = new UTF8Encoding(); requestHTML = myClient.DownloadData(currentPageUrl); myPageHTML = utf8.GetString(requestHTML); this code , it is reloading the page again and session is expiring.Is there anyother way to render it with perfection ? With regards...

    N D 2 Replies Last reply
    0
    • S Subin Mavunkal

      Hi , Is there any way to render an aspx page to string.I used some session variables and server controls in my page.When I render it using WebClient myClient = new WebClient(); string myPageHTML = null; byte[] requestHTML; string currentPageUrl = Request.Url.ToString(); UTF8Encoding utf8 = new UTF8Encoding(); requestHTML = myClient.DownloadData(currentPageUrl); myPageHTML = utf8.GetString(requestHTML); this code , it is reloading the page again and session is expiring.Is there anyother way to render it with perfection ? With regards...

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      // Open the requested URL
      WebRequest req = WebRequest.Create(strURL);

      // Get the stream from the returned web response
      StreamReader stream = new StreamReader(req.GetResponse().GetResponseStream());


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • S Subin Mavunkal

        Hi , Is there any way to render an aspx page to string.I used some session variables and server controls in my page.When I render it using WebClient myClient = new WebClient(); string myPageHTML = null; byte[] requestHTML; string currentPageUrl = Request.Url.ToString(); UTF8Encoding utf8 = new UTF8Encoding(); requestHTML = myClient.DownloadData(currentPageUrl); myPageHTML = utf8.GetString(requestHTML); this code , it is reloading the page again and session is expiring.Is there anyother way to render it with perfection ? With regards...

        D Offline
        D Offline
        doudoufly
        wrote on last edited by
        #3

        WebRequest HttpWebRequest = WebRequest.Create("url"); WebResponse HttpWebResponse = HttpWebRequest.GetResponse(); StreamReader sr = new StreamReader(HttpWebResponse.GetResponseStream(), System.Text.Encoding.UTF8); string strHtml = sr.ReadToEnd();

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups