无效的 URI:无法确定 URI 的格式

问题描述

我正在开发一个应用程序,该应用程序通过图像获取名称等信息,然后打印卡片。我正在使用 RDLC 报告的图像路径。

这里我设置的是上传图片到 Files 文件夹后的路径:

protected void UploadFile(object sender,EventArgs e)
    {
        string folderPath = Server.MapPath("~/Files/");

        //Check whether Directory (Folder) exists.
        if (!Directory.Exists(folderPath))
        {
            //If Directory (Folder) does not exists Create it.
            Directory.CreateDirectory(folderPath);
        }

        //Save the File to the Directory (Folder).
        FileUpload1.SaveAs(folderPath + Path.GetFileName(FileUpload1.FileName));

        //Display the Picture in Image control.
        _imageUrl = Image1.ImageUrl = "~/Files/" + Path.GetFileName(FileUpload1.FileName);
    }

   

点击按钮

protected void txtPrint_Click(object sender,EventArgs e)
    {
        ReportViewer1.LocalReport.DataSources.Clear();

        ReportViewer1.Visible = true;
        ReportViewer1.LocalReport.ReportPath = this.Context.Server.MapPath(@"~/Cards/Greetings.rdlc");
        ReportViewer1.LocalReport.EnableExternalImages = true;

        List<ReportParameter> param = new List<ReportParameter>();
       
        if (!string.IsNullOrEmpty(txtName.Text))
            param.Add(new ReportParameter("Name",txtName.Text));
        else
            param.Add(new ReportParameter("Name"," "));
        param.Add(new ReportParameter("Gender",ddlGender.SelectedValue));
        param.Add(new ReportParameter("Designation",""));
        if (!string.IsNullOrEmpty(Image1.ImageUrl)) {


        // this line is causing the issue
            param.Add(new ReportParameter("pImageUrl",new Uri(Image1.ImageUrl).AbsoluteUri));
        }
            

ReportViewer1.LocalReport.SetParameters(param);

      ... rest of the code

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...