如何在"通过电子邮件&QUOT发送的页面;在Internet Explorer功能选择发送作为电子邮件的正文,或作为附件? [英] How does the "send page by email" feature in Internet Explorer choose to send as the body of an email, or as an attachment?

查看:173
本文介绍了如何在"通过电子邮件&QUOT发送的页面;在Internet Explorer功能选择发送作为电子邮件的正文,或作为附件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Internet Explorer中的通过电子邮件发送页面功能为包括水晶报表ASP.Net观众提供应用程序的网页,它起草与网页在Outlook中的电子邮件作为附件,而不是身体的电子邮件。

与框架(V1.1)的previous版本,以及相关的Crystal报表查看器,这种情况并非如此。鉴于现在这些旧版本不支持,我想知道是否有什么办法可以鼓励的Internet Explorer通过电子邮件发送页面功能来发送我的ASP.Net页面身体,而不是作为附件?

有关参考,为观众来源很简单:

 <%@页面语言=VBAutoEventWireup =false的codebehind =GeneralReport.aspx.vb继承=MyApplication.GeneralReportForm%GT;
<%@注册标签preFIX =CR命名空间=CrystalDecisions.Web大会=CrystalDecisions.Web,版本= 10.5.3700.0,文化=中性公钥= 692fbea5521e1304%GT;
<!DOCTYPE HTML PUBLIC - // W3C // DTD HTML 4.0过渡// ENGT&;
< HTML>
    &所述; HEAD>
        <标题>< /标题>
        <元CONTENT =微软的Visual Studio.NET 7.0NAME =发电机>
        <元CONTENT =的Visual Basic 7.0NAME =code_LANGUAGE>
        <元CONTENT =JavaScript的NAME =vs_defaultClientScript>
        <元CONTENT =htt​​p://schemas.microsoft.com/intellisense/ie5NAME =vs_targetSchema>
        < LINK HREF =Styles.css中类型=文/ CSS的rel =stylesheet属性>
    < / HEAD>
    <身体GT;
        <表ID =Form1的方法=邮报=服务器>
            < D​​IV ID =contentstart>&安培; NBSP;< / DIV>
            < D​​IV>< CR:ID的CrystalReportViewer =的CrystalReportViewer=服务器DisplayToolbar =FALSESeparatePages =FALSE
                    HasDrillUpButton =假EnableDrillDown =假DisplayGroupTree =假HasSearchButton =假HasZoomFactorList =假
                    HasGotoPageButton =FALSE可见=假HEIGHT =50像素WIDTH =350像素>< / CR:&的CrystalReportViewer GT;
            < / DIV>
            < BR>
            < ASP:标签ID =lblError=服务器WIDTH =743pxFONT-SIZE =较大前景色=红>< / ASP:标签>
        < /表及GT;
    < /身体GT;
< / HTML>

在code的背后,我们只是有:

 昏暗RPT作为新MyReport()
rpt.SetDataSource(DS)
CrystalReportViewer.ReportSource = RPT
CrystalReportViewer.Visible = TRUE


解决方案

这可能不是直接回答你的问题,但
我建议让您的解决方案不是太依赖于浏览器的功能可能不是或在你的preferred浏览器的未来版本将支持不同

如果您的Web应用程序支持像为每个特定的报表呈现一个永久的URL,以URL作为链接的电子邮件应该够了。

另一种选择是,以使您的报告为PDF(或XLS)来获取可以安全地连接到您的电子邮件快照。

又一选择是不依赖于客户端浏览器的电子邮件的能力,但可以通过SMTP服务器发送由Web应用程序本身的电子邮件。

下面是如何与一个发送邮件的例子在VB.NET

附件

如果上面所有的不是一个选项,您,在某些情况下,我必须成功做什么改变IE浏览器发送一个额外的改变其猜测如何到手柄页内容的行为HTTP头(如 http://www.ietf.org/rfc/rfc2183.txt

内容处置:内联内容处置:附件

示例(C#)到最终报告在渲染之前把

  HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.Buffer = TRUE;
HttpContext.Current.Response.ContentType =text / html的;
HttpContext.Current.Response.AddHeader(内容处置,内联;文件名= report.htm);

When using the "Send page by email" feature in Internet Explorer for pages within our application that include a Crystal Reports ASP.Net viewer, it drafts the email in Outlook with the web page as an attachment, rather than as the body of the email.

With a previous version of the framework (v1.1), and associated Crystal report viewer, this was not the case. Given those older versions are now unsupported, I'd like to know if there is any way I can "encourage" the "Send page by email" feature of Internet Explorer to send my ASP.Net page as the body instead of as an attachment?

For reference, the source for the viewer is simply:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="GeneralReport.aspx.vb" Inherits="MyApplication.GeneralReportForm"%>
<%@ Register TagPrefix="cr" Namespace="CrystalDecisions.Web" Assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <HEAD>
        <title></title>
        <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
        <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
        <LINK href="Styles.css" type="text/css" rel="stylesheet">
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <div id="contentstart">&nbsp;</div>
            <DIV><CR:CRYSTALREPORTVIEWER id="CrystalReportViewer" runat="server" DisplayToolbar="False" SeparatePages="False"
                    HasDrillUpButton="False" EnableDrillDown="False" DisplayGroupTree="False" HasSearchButton="False" HasZoomFactorList="False"
                    HasGotoPageButton="False" Visible="False" Height="50px" Width="350px"></CR:CRYSTALREPORTVIEWER>
            </DIV>
            <br>
            <asp:label id="lblError" runat="server" Width="743px" Font-Size="Larger" ForeColor="Red"></asp:label>
        </form>
    </body>
</HTML>

In the code behind, we simply have:

Dim rpt As New MyReport()
rpt.SetDataSource(ds)
CrystalReportViewer.ReportSource = rpt
CrystalReportViewer.Visible = True

解决方案

This may not be a direct answer to your question, but I suggest making your solution not too dependent on a browser feature that may not be or be differently supported in future versions of your preferred browser.

If your web application supports something like a permanent URL for each specific report rendering, an email with the URL as a link should be enough.

Another option would be to render your report as PDF (or XLS) to get a snapshot that can be safely attached to your email.

Still another option is to not depend on the client's browser an email abilities but to send emails by the web application itself through an SMTP server.

Here is an example of how to send an email with an attachment in VB.NET

In case all of the above is not an option to you, in some cases I had success budging IE to change its guess-how-to-handle-page-content behavior by sending an additional http header (as defined in http://www.ietf.org/rfc/rfc2183.txt)

content-disposition: inline versus content-disposition: attachment

Example (C#) to put before final report rendering

HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.ContentType = "text/html";
HttpContext.Current.Response.AddHeader("content-disposition", "inline; filename=report.htm");

这篇关于如何在&QUOT;通过电子邮件&QUOT发送的页面;在Internet Explorer功能选择发送作为电子邮件的正文,或作为附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆