Hey everyone - Im new here. I appreciate any and all help you guys can provide! this is driving me crazy, and I am still wet behind the ears when it comes to asp.net.

I have 2 pages, index.aspx and downloads.aspx. There is a form on index.aspx that on submit server.transfer users to downloads.aspx (so i can use the form data from the downloads.aspx page) From downloads.aspx there are a number of download links that once one is clicked, I want the page to compose an email of the data from the form on index.aspx, as well as the product demo the user is downloading and then send it. I am having some major issue with this, and it seems like a very simple concept...Can anyone offer any suggestions?

<%@ Page Language="C#" EnableViewStateMac="False" Debug="true"%>
<%@ import Namespace="System" %>
<% @Import Namespace="System.Web.Mail" %>
<SCRIPT Runat="Server">

public void Page_Load(object sender, System.EventArgs e)
{
	transName.Text = Request.Form["tbxName"];
	transCompany.Text = Request.Form["tbxCompany"];
	transPhone.Text = Request.Form["tbxPhone"];
	transEmail.Text = Request.Form["tbxEmail"];
}

public void Button1_Click(object sender, EventArgs e) {
	if(Session["submitted"] == "false") {
		Mailit();
	}
}

public void Mailit() {
		MailMessage msgMail = new MailMessage();
		msgMail.To = "MY ADDRESS";
		msgMail.Cc = "";
		msgMail.Bcc = "";
		msgMail.From = "test";
		msgMail.Subject = "Product Download Customer Information";
		msgMail.BodyFormat = MailFormat.Html;
		string strBody = "<html><body><h2>Customer Information Collection</h2><p>The following data was acquired from a user accessing product downloads</p><table border='1'>" 
		+ "<tr><td><strong>Sent: </strong></td><td>" + DateTime.Now.ToString("ddd  MMM dd yyyy /  hh:mm")
		+ "<tr><td><strong>Name: </strong></td><td>" + transName.Text + "</td></tr>" 
		+ "<tr><td><strong>Company: </strong></td><td>" + Request.Form["tbxCompany"] + "</td></tr>" 
		+ "<tr><td><strong>Phone: </strong></td><td>" + Request.Form["tbxPhone"] + "</td></tr>" 
		+ "<tr><td><strong>Email: </strong></td><td>" + Request.Form["tbxEmail"] + "</td></tr>" 
		+ "</table></body></html>";
		msgMail.Body = strBody;
		
		SmtpMail.Send(msgMail);
		
        Session["submitted"] = "true";
		this.Response.Redirect("downloads.aspx");
}

</SCRIPT>

--][--

can you tell more clearly what you want to do with these two pages, and what is your problem?

can you tell more clearly what you want to do with these two pages, and what is your problem?

Sure thing.

I have 2 pages "index.aspx" and "downloads.aspx"

Index.asp
--has a form that has typical fields such as name, email, phone etc.
--once form is submitted server.transfer to send to downloads.aspx (so the form data is accessible from the downloads.aspx page)

downloads.aspx
--there is a list of downloads the user can click
--once one is clicked the previous form data (from index.aspx) as well as the name of the product they are downloading should be emailed.

Seems simple enough, I just cannot for the life of me do it...I managed to check that the form data was accessable from downloads.aspx, so i know thats working, I just cannot get the form data into the email!

Thanks,

--][--

I'm still having troubles with this...anyone have any ideas?

--][--

hmm, instead of using server.transfer, try using response.redirect and include the form values in the url as query strings. server.transfer method could be cumbersome in many cases. i didnt have time to examine your code though, but try more common way of passing values between pages like query strings, or try cross-page posting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.