积极答复者
载入执行后的.aspx文件

问题
-
您好,最近因为要做一个邮件发送的功能,需要把客户下单后购物车的信息以邮件的形式发给客户,在Email.aspx页面有如下代码:
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background-color: #f1f1f1; height: 25px; color: #8A7152; width: 60px">
Image
</td>
<td style="background-color: #f1f1f1; color: #8A7152; width: 200px; text-align: center">
Product
</td>
<td style="background-color: #f1f1f1; color: #8A7152; width: 100px;">
Unit Price
</td>
<td style="background-color: #f1f1f1; color: #8A7152; width: 100px;">
Quantity
</td>
<td style="background-color: #f1f1f1; color: #8A7152; width: 100px;">
Subtotal
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="border-bottom: solid #f1f1f1 1px">
<asp:Image ID="img" runat="server" ImageUrl='<%# Eval("Image") %>' Height="50px"
Width="50px" />
</td>
<td style="border-bottom: solid #f1f1f1 1px">
<%# Eval("ProductName")%>
Size:<%# Eval("Size")%>
</td>
<td style="border-bottom: solid #f1f1f1 1px">
<%# Eval("CurrentPrice") %>
</td>
<td style="border-bottom: solid #f1f1f1 1px">
<%# Eval("Quantity")%>
</td>
<td style="border-bottom: solid #f1f1f1 1px">
<%# Eval("TotalPrice") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
后台.cs文件如下
ICollection<CartItemInfo> cart = Profile.ShoppingCart.CartItems;
this.Repeater1.DataSource = cart;
this.Repeater1.DataBind();
发邮件的页面代码
string path = System.Web.HttpContext.Current.Server.MapPath("~/Email.aspx");
StreamReader sr = new StreamReader(path, System.Text.Encoding.Default);
StringBuilder body = new StringBuilder();
body.Append(sr.ReadToEnd());
sr.Close();
...此处发送sendemail(把相关参数放这里还有body.tostring())
大概的思路是这样,但是因为Email.aspx是有代码的,所以这样发送的是没执行的Email.aspx页面,发送的邮件变成Email.aspx页面的源代码了,请问怎么才能再发送邮件的时候返回执行后的Email.aspx页面呢,谢谢!
答案
全部回复
-
参看我刚发的帖子
http://social.msdn.microsoft.com/Forums/zh-CN/295/thread/31fc928e-adfb-4c15-9659-a68e7bb35e42
我和楼主要实现的功能一样,但遇到了另一个诡异的问题