file upload

Topics: General
Jun 9, 2011 at 1:54 AM

can someone please provide me with sample code on how to capture user data, upload a file and send all this data and uploaded file via email. thanks in advance.

Jun 10, 2011 at 11:29 AM

Create a Web Forms user control (ascx) that does the job and include it on your page using the Composite.AspNet.LoadUserControl() function.

The work can be broken up into uploading files via a form and sending a file attachment via an e-mail.

Note that you need to update web.config with information about what e-mail server (SMTP server) to use for sending e-mail - this configuration is specific to your environment. We have written a small guide on SMTP configuration you can use.

Jun 13, 2011 at 12:53 AM

the problem I am having is after creating the pages its not executing my code behind, it works if I run the ascx on a separate project but not when I call it from the  what is the proper way to configure to make sure the code behind is executed/fired. thanks in advance

Jun 24, 2011 at 6:52 AM

here my setup:

page content:
<html xmlns="">
    <f:function name="Composite.AspNet.LoadUserControl" xmlns:f="">
      <f:param name="Path" value="~/Controls/WebUserControl.ascx" />

part of template (pay attention to the asp:form tag - its must!):
     <rendering:placeholder id="contentplaceholder" title="Content" default="true" />

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="Controls_WebUserControl" %>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Controls_WebUserControl : UserControl
	protected void Page_Load(object sender, EventArgs e)

	protected void Button1_Click(object sender, EventArgs e)
		Button1.Text = "OK";

when I click  - got OK.

Hope it's helps.