Asp.net mvc 2 ASP.NET 2.0页面在System7 IIS 7.5下收到HTTP错误403,但在Server2008 Std IIS 7.0下工作正常

Asp.net mvc 2 ASP.NET 2.0页面在System7 IIS 7.5下收到HTTP错误403,但在Server2008 Std IIS 7.0下工作正常,asp.net-mvc-2,Asp.net Mvc 2,这是我的密码: protected void btnPrint_Click(object sender, System.EventArgs e) { try { // some variables const string number_of_parameters = "5"; const string name_of_parameters = "AccountID|Retur

这是我的密码:

    protected void btnPrint_Click(object sender, System.EventArgs e)
    {
        try
        {
            // some variables
            const string number_of_parameters = "5";
            const string name_of_parameters = "AccountID|ReturnAddress|StatementDate|SubTotalByAccount|SubTotalByDept|";
            const string outf = "-Epdf";
            string value_of_parameters;
            string output_file_name;
            string vAttachment;
            byte[] myFile;
            string ExportDirectory = HttpContext.Current.Request.PhysicalApplicationPath + "Reports\\OutPut\\" +
                AppLib.GetSessionValue("UserID").Trim() + "\\";

            // Email Statements if it is set in Defaults
            bool isEmailed = false;
            LLdataSet.S_Invoice_EmailRow emailRow = null;
            if (defaultsRow.DefEmailStatements)
            {
                emailRow = emailLogic.GetEmailSetupByID(2);
                if (trEmail.Visible == true && rblEmail.SelectedValue == "1")
                    isEmailed = true;
            }

            // Archive Statements if S_CUSTOMER_INTEGRATION supports it and it is set in Defaults
            bool isArchived = false;
            DateTime deleteDate = DateTime.Parse("1/1/1900");
            if (BaseControl.CheckCustomerIntegrationSetings("UseAdvancedDocLib") == "1")
            {
                if (defaultsRow.DefArchiveMonths > 0)
                {
                    deleteDate = DateTime.Today.AddMonths(defaultsRow.DefArchiveMonths);
                    if (trAchive.Visible == true && rblArchive.SelectedValue == "1")
                        isArchived = true;
                }
            }

            //Make sure ARTempReport is empty
            reportLogic.CoastClear();

            //Run a detailed ARTB
            SqlParameter[] myParamList = new SqlParameter[11];
            myParamList[0] = new SqlParameter("@location", SqlDbType.NVarChar, 10);
            myParamList[0].Value = ddlLocation.SelectedValue;
            myParamList[1] = new SqlParameter("@route", SqlDbType.NVarChar, 10);
            myParamList[1].Value = "%";
            myParamList[2] = new SqlParameter("@salesPerson", SqlDbType.NVarChar, 4);
            myParamList[2].Value = "%";
            myParamList[3] = new SqlParameter("@chain", SqlDbType.NVarChar, 10);
            myParamList[3].Value = "%";
            myParamList[4] = new SqlParameter("@customerGroup", SqlDbType.NVarChar, 10);
            myParamList[4].Value = "%";
            myParamList[5] = new SqlParameter("@aquireGroup", SqlDbType.NVarChar, 5);
            myParamList[5].Value = "%";
            myParamList[6] = new SqlParameter("@agingStatus", SqlDbType.NVarChar, 10);
            myParamList[6].Value = "0";
            myParamList[7] = new SqlParameter("@reportType", SqlDbType.NVarChar, 10);
            myParamList[7].Value = "1";
            myParamList[8] = new SqlParameter("@asOfDate", SqlDbType.NVarChar, 10);
            myParamList[8].Value = txtDate.Text;
            myParamList[9] = new SqlParameter("@userName", SqlDbType.NVarChar, 30);
            myParamList[9].Value = AppLib.GetSessionValue("UserID");
            myParamList[10] = new SqlParameter("@checkUseStatements", SqlDbType.Bit, 1);
            myParamList[10].Value = true;
            string vConnStr = AppLib.GetSessionValue("ConnectionString");
            DBLib.RunStoredProc("dbo.FaR_TrialBalance", vConnStr, myParamList);


            //Iterate througe list of unique accounts
            List<int> accountList = reportLogic.GetDistinctAccounts();
            foreach (int vAccountID in accountList)
            {
                customerRow = customerLogic.GetByID(vAccountID);
                value_of_parameters = vAccountID.ToString() + "|" + rblReturnAddress.SelectedValue + "|" +
                    txtDate.Text + "|" + customerRow.UseSubtotalByAccount.ToString() + "|" +
                    customerRow.UseSubtotalByDepartment.ToString() + "|";
                output_file_name = "ARST_" + txtDate.Text.Replace("/", "") + "_" + vAccountID.ToString();
                string[] arg = { outf, "-XFile", "-O" + output_file_name, "-N" + number_of_parameters, "-A" + name_of_parameters, "-J" + value_of_parameters };
                RptInfo rf = new RptInfo(arg);
                rf.DatabaseName = DataBase.ToString().Trim();
                //Create the pdf
                vAttachment = rf.CrExport("ARReports\\Statements.rpt");

                if (isEmailed && trEmail.Visible)
                {
                    // email to all contacts
                    List<string> emailList = deptLogic.GetAPContacts(vAccountID);
                    if (emailList.Count > 0)
                    {
                        FuncLib.SendEmail(emailRow.Host, emailRow.FromEmail, string.Join(";", emailList.ToArray()), "",
                            emailRow.Subject, emailRow.Body, Server.MapPath(vAttachment), (int?)emailRow.Port, (int?)emailRow.Priority,
                            (bool?)emailRow.EnableSs1, emailRow.Username, emailRow.Password);
                    }
                }

                if (isArchived && trAchive.Visible)
                {
                    //store the pdf in the customer's documents repository
                    myFile = System.IO.File.ReadAllBytes(Server.MapPath(vAttachment));
                    documentLogic.AddDocument(customerRow.Location, customerRow.Account, output_file_name + ".pdf", "Statement As Of " + txtDate.Text,
                        1, myFile, deleteDate);
                }
                //string message1 = "<FONT color=\"blue\"><STRONG> Account#" + vAccountID.ToString() + "</STRONG></FONT>: Statement Created <br>";
                //Response.Write(message1);
                //Response.Flush();
            }
protectedvoid btnPrint\u单击(对象发送方,System.EventArgs e)
{
尝试
{
//一些变量
常量字符串编号,参数为“5”;
const string name_of_parameters=“AccountID | ReturnAddress | StatementDate | SubTotalByAccount | SubTotalByDept |”;
常量字符串输出=“-Epdf”;
参数的字符串值;
字符串输出\文件\名称;
字符串连接;
字节[]myFile;
string ExportDirectory=HttpContext.Current.Request.PhysicalApplicationPath+“报告\\输出\\”+
AppLib.GetSessionValue(“UserID”).Trim()+“\\”;
//电子邮件语句(如果设置为默认值)
bool isEmailed=false;
LLdataSet.S_发票_EmailRow EmailRow=null;
if(defaultsRow.defmailstatements)
{
emailRow=emailLogic.GetEmailSetupByID(2);
如果(trEmail.Visible==true&&rblEmail.SelectedValue==1)
isEmailed=true;
}
//如果S_CUSTOMER_INTEGRATION支持并设置为默认值,则存档语句
bool isArchived=false;
DateTime deleteDate=DateTime.Parse(“1/1/1900”);
if(BaseControl.checkCustomerIntegrationSettings(“UseAdvancedDocLib”)=“1”)
{
如果(defaultsRow.DefArchiveMonths>0)
{
deleteDate=DateTime.Today.AddMonths(defaultsRow.DefArchiveMonths);
if(trAchive.Visible==true&&rblArchive.SelectedValue==1)
isArchived=真;
}
}
//确保ARTempReport为空
reportLogic.CoastClear();
//运行详细的ARTB
SqlParameter[]myParamList=新的SqlParameter[11];
myParamList[0]=新的SqlParameter(“@location”,SqlDbType.NVarChar,10);
myParamList[0]。值=ddlLocation.SelectedValue;
myParamList[1]=新的SqlParameter(“@route”,SqlDbType.NVarChar,10);
myParamList[1]。值=“%”;
myParamList[2]=新的SqlParameter(@salesPerson),SqlDbType.NVarChar,4);
myParamList[2]。值=“%”;
myParamList[3]=新的SqlParameter(“@chain”,SqlDbType.NVarChar,10);
myParamList[3]。值=“%”;
myParamList[4]=新的SqlParameter(“@customerGroup”,SqlDbType.NVarChar,10);
myParamList[4]。值=“%”;
myParamList[5]=新的SqlParameter(“@aquireGroup”,SqlDbType.NVarChar,5);
myParamList[5]。值=“%”;
myParamList[6]=新的SqlParameter(“@agingStatus”,SqlDbType.NVarChar,10);
myParamList[6]。Value=“0”;
myParamList[7]=新的SqlParameter(“@reportType”,SqlDbType.NVarChar,10);
myParamList[7]。Value=“1”;
myParamList[8]=新的SqlParameter(“@asOfDate”,SqlDbType.NVarChar,10);
myParamList[8]。值=txtDate.Text;
myParamList[9]=新的SqlParameter(“@userName”,SqlDbType.NVarChar,30);
myParamList[9].Value=AppLib.GetSessionValue(“用户ID”);
myParamList[10]=新的SqlParameter(“@checkUseStatements”,SqlDbType.Bit,1);
myParamList[10]。值=true;
字符串vConnStr=AppLib.GetSessionValue(“ConnectionString”);
DBLib.RunStoredProc(“dbo.FaR_TrialBalance”,vConnStr,myParamList);
//遍历唯一帐户的列表
List accountList=reportLogic.GetDistinctAccounts();
foreach(accountList中的int vAccountID)
{
customerRow=customerLogic.GetByID(vAccountID);
参数的值=vAccountID.ToString()+“|”+rblReturnAddress.SelectedValue+“|”+
txtDate.Text+“|”+customerRow.UseSubtotalByAccount.ToString()+“|”+
customerRow.UseSubtotalByDepartment.ToString()+“|”;
输出文件\u name=“ARST\u”+txtDate.Text.Replace(“/”,“”)+“\u”+vAccountID.ToString();
字符串[]arg={outp,“-XFile”,“-O”+输出文件名,“-N”+输出参数数,“-A”+输出参数名,“-J”+输出参数值};
RptInfo rf=新的RptInfo(arg);
rf.DatabaseName=DataBase.ToString().Trim();
//创建pdf
vatachment=rf.creexport(“ARReports\\Statements.rpt”);
如果(ISemail&&trEmail.Visible)
{
//向所有联系人发送电子邮件
List emailList=deptLogic.GetAPContacts(vAccountID);
如果(emailList.Count>0)
{
FuncLib.sendmail(emailRow.Host,emailRow.FromEmail,string.Join(“;”,emailList.ToArray()),“”,
emailRow.Subject,emailRow.Body,Server.MapPath(vatachment),(int?)emailRow.Port,(int?)emailRow.Priority,
(bool?)emailRow.EnableSs1,emailRow.Username,emailRow.Password);
}
}
如果(isArchived&&trAchive.Visible)
{
//将pdf存储在客户的文档存储库中
myFile=System.IO.File.ReadAllBytes(Server.MapPath(vatachment));
documentLogic.AddDocument(customerRow.Location、customerRow.Account、输出文件名+“.pdf”、“截至”+txtDate.Text的报表、,
1,我的文件,删除日期);
}
//字符串消息1=“帐户#”+vAccountID.ToString()+”:创建的语句
”; //回复。写(message1); //Response.Flush(); }
我的问题是,一旦我单击触发此代码的按钮(这两种情况都是如此)