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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:07:41+00:00 2026-06-02T08:07:41+00:00

Okay so, I can send the current pages contents to email just fine, formatting

  • 0

Okay so, I can send the current pages contents to email just fine, formatting it is a bit strange and ends up a little differently than expected, but I am getting the hang of it.

What I am currently wanting to do is to send and access a previous pages entire formatted form within the current one (I am thinking this can be done with a session object) and then send this to email. This includes user input into text boxes etc (which I am currently persisting across the pages via session objects [if this matters]).

I have tried to search google and this site with nothing that really solves these issues, and there are several of them.

If someone could point me in the right direction, it would be greatly appreciated.

For clarity, here is the process I am utilizing to send the current page via email:

    StringWriter sw = new StringWriter( );
    HtmlTextWriter w = new HtmlTextWriter( sw );
    MAIN.RenderControl( w );
    string s = sw.GetStringBuilder( ).ToString( );

    MailMessage message = new MailMessage( );
    message.IsBodyHtml = true;
    message.To.Add( new MailAddress( Session["eMail"].ToString( ) ) );
    message.Subject = "foo bar";
    message.From = new MailAddress( "email@email.com" );
    message.Body = s; //this would be filled with the previous page

So basically, the message.Body would be the form contents (formatted and with all user content) of a previous page.

Thanks in advance!

EDIT: I do not mean the literal previous page before the one you would currently be on, I mean a page that was previous in the process to getting to this page (in my case it is the second page in the process and the email will be sent at the fourth page).

  • 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-06-02T08:07:46+00:00Added an answer on June 2, 2026 at 8:07 am

    if you know all the parameters your previous page was given, you can create an instance of your page and generate it’s HTML.

    I’ve written a blog post about it here:

    http://www.diaryofaninja.com/blog/2009/09/14/a-simple-solution-to-viewing-a-preview-of-any-page-in-your-site

    Basically this means tapping into the ASP.Net runtime and executing the page through its lifecycle – if your page has any public properties such as content ID’s etc you can set them as part of this.

    Page tempPage = new Views.Blog.BlogDetail();
    tempPage.PageIntro = intro;
    tempPage.PageContent = content;
    
    StringWriter sw = new StringWriter();
    HttpContext.Current.Server.Execute(tempPage, sw, false);
    if (!String.IsNullOrEmpty(sw.ToString()))
    {
        return sw.ToString();
    }
    

    Obviously this is not getting the previous page, but instead generating it all over again and getting its content.

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

Sidebar

Related Questions

Okay, I just can't get my head around multi-threading scenarios properly. Sorry for asking
Okay i'm a little bit stuck on how to solve this problem. When a
Okay, my situation is such: I need to send the contents of a JavaScript
Okay I'll try describe this the best way I can. I have a chat
Okay I've been doing JS merges for some time now and still can't figure
Okay, so I want to have a generic method that can read data from
Okay, I've been working on this for days now and I can't find any
Okay people, I'm sure someone has had this issue and can help me out.
Okay, so I have a website where the user can put a search query
Okay at first I thought this would be pretty straightforward. But I can't think

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.