我正在尝试将二进制图像从StudentSearch
页传递到StudentIndividual
页。我想通过StudentIndividual
页面中的“图像”控件显示该二进制图像,除二进制图像外,其他所有学生详细信息都可以成功显示。
这是我的StudentSearch.aspx
html代码,如下所示:
<asp:HyperLink runat="server" NavigateUrl='<%# string.Format("~/StudentIndividual.aspx?SID={0}&FName={1}&LName={2}&HomeAddress={3}&Gender={4}&DOB={5}&Image={6}",
HttpUtility.UrlEncode(Eval("SID").ToString()), HttpUtility.UrlEncode(Eval("FName").ToString()),
HttpUtility.UrlEncode(Eval("LName").ToString()), HttpUtility.UrlEncode(Eval("HomeAddress").ToString()),
HttpUtility.UrlEncode(Eval("Gender").ToString()),HttpUtility.UrlEncode(Eval("DOB").ToString()),HttpUtility.UrlEncode(Eval("Image").ToString())) %>'
Text="View Details" />
StudentIndividual.aspx.cs
如下:
LabelSID.Text = HttpUtility.UrlDecode(Request.QueryString["SID"]);
LabelFName.Text = HttpUtility.UrlDecode(Request.QueryString["FName"]);
LabelLName.Text = HttpUtility.UrlDecode(Request.QueryString["LName"]);
LabelHomeAddress.Text = HttpUtility.UrlDecode(Request.QueryString["HomeAddress"]);
LabelGender.Text = HttpUtility.UrlDecode(Request.QueryString["Gender"]);
LabelDOB.Text = HttpUtility.UrlDecode(Request.QueryString["DOB"]);
this.Image1.ImageUrl = "data:image/jpg;base64," + HttpUtility.UrlDecode(Request.QueryString["Image"]);
问题应该在这里,我试图删除ToString(),但无法正常工作。
HttpUtility.UrlEncode(Eval("Image").ToString()