C# 开放重定向强化问题
最近,我开始研究fortify工具记录的一些安全问题。 我正在处理开放重定向问题,发现我们需要对Querystring参数值进行编码,因此我在示例应用程序中尝试了相同的方法,但当我观察到时,输入数据没有编码 我尝试了以下方法:C# 开放重定向强化问题,c#,C#,最近,我开始研究fortify工具记录的一些安全问题。 我正在处理开放重定向问题,发现我们需要对Querystring参数值进行编码,因此我在示例应用程序中尝试了相同的方法,但当我观察到时,输入数据没有编码 我尝试了以下方法: protected void Button1_Click(object sender, EventArgs e) { string s1 = TextBox1.Text; string s11 = HttpUtility.HtmlE
protected void Button1_Click(object sender, EventArgs e)
{
string s1 = TextBox1.Text;
string s11 = HttpUtility.HtmlEncode(s1);
Server.UrlEncode(s1);
Server.HtmlEncode(s1);
Response.Redirect(Server.UrlPathEncode("WebForm2.aspx?&Name=" + s11));
}
当我在调试期间看到该值时,它没有编码,请帮助我这里缺少什么。有没有其他方法可以解决这个问题。希望这是您要找的
protected void Button1_Click(object sender, EventArgs e)
{
string s1 = TextBox1.Text;
string s11 = HttpUtility.UrlEncode(s1);
Response.Redirect("WebForm2.aspx?&Name=" + s11));
}
我将其改为HttpUtility.UrlEncode,但该值未进行编码。