我想通过查询字符串将值传递给另一页,但它将它们发送为空。为什么?为什么查询字符串发送空变量?
<a href='UpcomingNotifications.aspx?OrgID=<%# SharedUtility.EncryptURL("10") %>&RoleID=<%# SharedUtility.EncryptURL("1") %>'
target="_blank"
class="pull-right"
style="margin-top: -44px; margin-right: 6px;">
<asp:Label ID="lblUpcomingWorks" runat="server"
CssClass="btn btn-sm- btn-danger"
Text=" Upcoming Works Openings" Visible="false" />
</a>
输出: http://localhost:5297/forms/admin/UpcomingNotifications.aspx?OrgID=&RoleID=
更新:加密方法:这是写
public static String EncryptURL(string strData)
{
try
{
if (!String.IsNullOrEmpty(strData))
{
SHA1Managed shaM = new SHA1Managed();
Convert.ToBase64String(shaM.ComputeHash(Encoding.ASCII.GetBytes(strData)));
Byte[] encByteData;
encByteData = ASCIIEncoding.ASCII.GetBytes(strData);
String encStrData = Convert.ToBase64String(encByteData);
return encStrData;
}
else
{
return "";
}
}
catch (Exception) { return ""; }
}
哪一种由'SharedUtility.EncryptURL()'方法返回的值?尝试使用'<%= SharedUtility.EncryptURL(“n”)%>'来呈现文字字符串。 –
它返回字符串数据,但在我的情况下,它返回空字符串 – Covert
,我试着你说的,但仍然是空的 – Covert