web.config中我需要认证<authentication mode="Forms"/>
  <authorization>
<deny users="?"/>
</authorization> 
结果用水晶报表倒出成word的时候,导出的报表页面就变成了登陆页面,我发现如果我装的是office xp就正常成报表,如果是office 2000就成了登陆页面Login.aspx,请高手指教!以下是导出程序
/// <summary>
/// 导出报表
/// </summary>
public void ExportDocument()
{
ExportOptions crExportOptions=new ExportOptions();
DiskFileDestinationOptions crDestinationOptions=new DiskFileDestinationOptions();
crDestinationOptions.DiskFileName=exportPath;
crExportOptions=rc.ExportOptions; crExportOptions.DestinationOptions=crDestinationOptions;
crExportOptions.ExportDestinationType=ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType=format;
rc.Export(); System.Web.HttpResponse Response=System.Web.HttpContext.Current.Response;

Response.ClearContent();
Response.ClearHeaders();
Response.ContentType=contentType;
// Response.AppendHeader("",
Response.WriteFile(exportPath);
Response.Flush();
Response.Close(); try
{
System.IO.File.Delete(exportPath);
}
catch
{
}
}

解决方案 »

  1.   

    Mark自行Debug看看什么时候跳转到login页面的呢看不出什么问题来
      

  2.   

    Debug  运行catch()异常的地方设置断点,看看抛出了什么异常了?
      

  3.   

    呵呵,这个问题我遇到过了,想想,是谁执行导出报表的操作?是ASP。NET,ASP。NET使用的帐号是哪一个,它访问你自己的WEB应用程序,也需要认证,这样,就会出现登陆页。解决方法是,在应用程序下建一子目录,然后加入一个web.config文件,里面要allow user='*'导出页要位于该了目录。不知道说清楚没有?
      

  4.   

    对不起,说错了,你不应该用response.close
    查一下帮助文件,就知道,response.close会关闭Session,引发Session_end事件,相当于你login out了哈。
      

  5.   

    http://blog.csdn.net/goody9807/articles/138822.aspx
      

  6.   

    555感谢 wanddy(Wanddy Huang) (