开发者

slash character ignored when send query string for asp.net

ResponseHelper.Redirect("popup.aspx?file= "+ LogicLayer.ManualPath + _ddlPLCs.SelectedValue.ToString() + "\\" + _PLCRow[0][0].ToString() ,"_page", "menubar=0,width=100,height=100");

in the second page :

if (Request.QueryString["fi开发者_开发百科le"] != null)
        {
            LogicLayer.viewManual(Request.QueryString["file"].ToString());
        }

i found that slash (\) characters is removed from the file path

are there any idea ???


The backslash (\) is not acceptable in a URL. You have to encode the characters to a %HEX value. In ASP.Net there is a method to encode a URL string, and one to decode the string.

In the View:

ResponseHelper.Redirect("popup.aspx?file= "+ System.Web.HttpUtility.UrlEncode(LogicLayer.ManualPath + _ddlPLCs.SelectedValue.ToString() + "\\" + _PLCRow[0][0].ToString()) ,"_page", "menubar=0,width=100,height=100");

In the Code Behind:

if (Request.QueryString["file"] != null)
{
   LogicLayer.viewManual(HttpServerUtility.UrlDecode(Request.QueryString["file"].ToString()));
}

Here's a similar question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜