本文介绍了错误:值不能为null.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取下载对话框,但我不断收到表示Value cannot be null.Parameter name: path1
的错误我不明白,请帮忙.

这是给我错误的代码

I am trying to get a download dialogbox i keep getting the error that says Value cannot be null.Parameter name: path1
I don''t understand please help.

This is the code that''s giving me the error

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Configuration;



namespace New
{
    public partial class DownloadFile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString.Get("ID") != null)
            {
                Response.Clear();
                Guid ID = new Guid(Request.QueryString.Get("ID"));
                BLL.FileSave myFile = new BLL.FileSave();


                Response.ContentType = "application/x-uknown";
                Response.AppendHeader("Content_Disposition", "attachment; fileName=\"" + myFile.originalName + "\"");


                if (myFile.containsFile)
                {
                    Response.BinaryWrite(myFile.fileData);
                }
                else
                {
//the error is here
                    Response.WriteFile(Path.Combine(Bll.AppConfiguration.UploadsFolder, myFile.fileUrl));
               }

            }
        }
    }
}

推荐答案



这篇关于错误:值不能为null.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:32
查看更多