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. General Programming
  3. Visual Basic
  4. Server.Execute Issues Capturing resulting HTML from aspx page execution.

Server.Execute Issues Capturing resulting HTML from aspx page execution.

Scheduled Pinned Locked Moved Visual Basic
helpcsharphtmlasp-netsysadmin
1 Posts 1 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.
  • T Offline
    T Offline
    Tom G
    wrote on last edited by
    #1

    I'm currently buidling an ASP.NET application that requires custom HTML emails be sent. I was going to use "Sever.Execute" to capture the result of an aspx template execution and use it as the body of an HTML email. This works, but it only works if it is called from the "Page_Load" Sub. As soon as I call it from an event sub it fails and returns a "Corrupt ViewState" Error. Is this normal? Does "Server.Execute" only work in Page_Load? Is there another/better way to do this? Help is appreciated. Code: **** This Works **** Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SendItDude() End Sub **** This Doesn't Work *** Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click SendItDude() End Sub Public Sub SendItDude() Dim EM As CarSystem.Emailer = New CarSystem.Emailer() Dim writer As New StringWriter() Dim x As Integer = 1 Dim List(x) As Integer List(0) = 3332 List(1) = 3332 Server.Execute("../Assignpreview.aspx?car_id=7", writer) Response.Write(EM.Email_it(8, List, 3332, "This is a test", writer.ToString())) End Sub

    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