错误:值不能为null. [英] Error : Value cannot be null..

查看:283
本文介绍了错误:值不能为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));
               }

            }
        }
    }
}

推荐答案

您没有提供任何带有标识符"path1"的代码片段.无法得到错误"并且看不到该错误在哪一行生成;这是不可能的.不可能甚至没有指出错误"类型的答案:编译时,运行时异常还是什么?

只有真正能够提出问题并能够获得帮助的人才能提供帮助.

—SA
You did not provide any fragment of code with the identifier "path1". It is not possible to get an "error" and do not see on what line this error was generated; it''s not possible to expect an answer not even indicating the kind of "error": compile-time, run-time exceptions, or what?

A help could only be provided to a person who can really formulate a problem and able to get help.

—SA


尝试并调​​试代码以找出发生此错误的位置.
确保您需要传递给对话框的所有必需值都不为空.
Try and debug your code to find out where this error occurs.
Ensure that all mandatory values you need to pass into the dialog are not null.


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

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