如何在asp.net中传递查询字符串,其中包含“ '' (单引号)里面) [英] How do I pass a query string in asp.net which has " ' " (single quote) in it)

查看:196
本文介绍了如何在asp.net中传递查询字符串,其中包含“ '' (单引号)里面)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.net中有一个查询字符串。它按预期将值传递给另一页,但是当传递的值包含''(单引号)时,它会显示错误。喜欢它是我有什么方法可以摆脱这个问题。我想使用查询字符串。另外我可以使用会话。

解决方案

点击它 [ ^ ]



加密查询字符串 [ ^ ]

ans:

  string   value  =  'a'b'+ c ; 
Response.Redirect( 〜/ WebForm3.aspx?id = + HttpUtility.UrlEncode ( value )+ );
// 重新检索值就像它一样简单
响应。写(Request.QueryString [ id]);


I have a query string in ASP.net . It passes the values to the other page as expected but it shows an error when the passed value contains " '' " (single quote). like "It''s" Is there any way I can get rid of this issue. I want to use query string. other wise I could have used sessions.

解决方案

Click it[^]

Encrypting Query Strings[^]
ans:

 string value = "'a'b'+c";        
 Response.Redirect("~/WebForm3.aspx?id=" + HttpUtility.UrlEncode(value) + "");
//to retrive the value is as simple as it is
 Response.Write(Request.QueryString["id"]);


这篇关于如何在asp.net中传递查询字符串,其中包含“ '' (单引号)里面)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆