내가 텍스트 상자를 사용하여 사용자의 수량을 요청하고 그것으로 계산을 수행 한 후, 나는에 결과를 표시 할 다른 페이지의 레이블. 여기
는 confirm.aspx.cspublic partial class confirm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["user"] != null)
{
Label2.Text = Server.HtmlEncode(Request.Cookies["user"]["userName"]);
Label3.Text = Server.HtmlEncode(Request.Cookies["user"]["email"]);
Label1.Text = Server.HtmlEncode(Request.Cookies["user"]["items"]);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Session.Add("TextBox1Value", TextBox1.Text);
Response.Redirect("total.aspx");
}
}
을위한 코드이며, 여기에 내가 잘못이나 될 수있다 생각합니다 어느 곳
public partial class total : System.Web.UI.Page
{
int totalprice;
protected void Page_Load(object sender, EventArgs e)
{
//Label1.Text = Server.HtmlEncode(Request.Cookies["confirm"]["quantity"]);
int quantity = Session["TextBox1Value"];
if (Request.Cookies["user"]["items"] == "Tyres")
{
totalprice = 20 * quantity;
Label2.Text = totalprice.ToString();
}
}
}
total.aspx.cs, 다른 페이지에 대한 코드입니다 어떻게 할 수 있습니까?
'.Text' 속성은 이미 인코딩됩니다. 이중 인코딩해서는 안됩니다. – SLaks