查询字符串中的传递日期问题 [英] Problem with pass date in querystring
本文介绍了查询字符串中的传递日期问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个波斯日期选择器,我从查询字符串传递它的值(我只是从datepicker获取日期并传递到其他页面)。
我在datepicker中的数字是波斯语
我的问题是:目的地信息。
像这张照片的一些角色: http://s6.uplod.ir/i/00799/p0ljg4xla890.jpg [ ^ ]
i have one persian datepicker and i pass the value of it from query string (i just get date from datepicker and pass to other page).
my numbers in datepicker are persian
my problem is : destinations info.
some character like this photo : http://s6.uplod.ir/i/00799/p0ljg4xla890.jpg[^]
protected void Button1_Click(object sender, EventArgs e)
{
string from = fromDate1.Value;
string to = toDate1.Value;
string city = TextBox1.Text;
if (!String.IsNullOrEmpty(city))
{
if (!String.IsNullOrEmpty(from))
{
if (!String.IsNullOrEmpty(to))
{
Response.AddHeader("REFRESH", "1;search.aspx?c=" + city + "&from=" + from + "&to=" + to);
}
else
{
Label1.Text = "تاریخ را وارد نکرده اید.";
}
}
else
{
Label1.Text = "تاریخ را وارد نکرده اید.";
}
}
else
{
Label1.Text = "نام شهر را وارد نکرده اید.";
}
}
推荐答案
您需要对查询字符串中的值进行URL编码。最好使用Response.Redirect
而不是刷新
标题。
You need to URL-encode the values in the query-string. It would also be better to useResponse.Redirect
instead of theRefresh
header.
Response.Redirect(string.Format("search.aspx?c={0}&from={1}&to={2}",
HttpUtility.UrlEncode(city),
HttpUtility.UrlEncode(from),
HttpUtility.UrlEncode(to)));
这篇关于查询字符串中的传递日期问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文