qq_27602361 2015-09-25 05:58 采纳率: 61.5%
浏览 2051

用户代码为处理httpexception

string name = FileUpload1.FileName;
string size = FileUpload1.PostedFile.ContentLength.ToString();
string type = FileUpload1.PostedFile.ContentType;
string type2 = name.Substring(name.LastIndexOf(".") + 1);
string ipath = Server.MapPath("\upimg") + "\" + name;
string fpath = Server.MapPath("..\upfile") + "\" + name;
string wpath = "..\upimg\" + name;

        if (type2 == "xls")
        {
            FileUpload1.SaveAs(fpath);
            //Image1.ImageUrl = wpath;
            Label1.Text = "你传的文件名称是:" + name + "<br>文件大小为:" + size + "字节<br>文件类型是:" + type + "<br>后缀名是:" + type2 + "<br>实际路径是:" + ipath + "<br>虚拟路径是:" + wpath;
            Response.Redirect("index.asp?filename=" + name);
        }
        else
        {
            //Image1.Visible = false;
            //FileUpload1.SaveAs(fpath);
            Label1.Text = "<font color=red>请你选择.Microsoft Office Excel文件,格式为.xls。</font>";

                             string fpath = Server.MapPath("..\\upfile") + "\\" + name;这里提示用户代码为处理httpexception:“System.Web.HttpException”类型的异常在 System.Web.dll 中发生,但未在用户代码中进行处理。其他信息: 无法使用前导 .. 在顶级目录上退出。
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 outlook无法配置成功
    • ¥15 Pwm双极模式H桥驱动控制电机
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换