是否有一个库可以在我当前的ASP.NET应用程序中使用,以验证queryStrings?
编辑〜使用正则表达式查找模式,如字符串,仅限数字,仅限数字,长度为x的字符串,等等
谢谢
我试图循环查询字符串并提取某些值,如:
?ProductID=1234&ProductID=4321&Quantity=1
Run Code Online (Sandbox Code Playgroud)
对于ProductID旁边的每个值,我想执行一些逻辑.但我不确定如何达到价值观.有任何想法吗?
我的页面上有一个文章列表,我希望能够通过将$ _GET值附加到URL来应用无数种类和过滤器:
http://www.example.com/blogs.php?sort=newest&popularity=high&length=200
如果我在我的页面上有链接将这些值附加到网址...他们需要足够聪明,以便考虑应用的任何先前的排序/过滤器.
例1:
如果我现在有... http://www.example.com/blogs.php?sort=newest
然后我想附加一个人气=高的额外过滤器,我需要这个:
http://www.example.com/blogs.php?sort=newest&popularity=high
而不是这个:
http://www.example.com/blogs.php?popularity=high
例2:
如果我有... http://www.example.com/blogs.php?popularity=high
我试图改变我的人气过滤器,我不想要:
http://www.example.com/blogs.php?popularity=high&popularity=low
所以简单地添加到查询字符串将不会飞.
因此,构建我的过滤器链接以便他们"记住"旧过滤器的可扩展方法是什么,但是在需要时仍会覆盖自己的过滤器值?
我目前正在使用多个查询字符串参数将一些数据从一个页面传递到第二个页面(参数保存确认/错误消息显示在第二页中),由于第三方产品无法再正常工作生产环境.用户在第一页上完成操作,然后转移到第二页.使用哪些可能的替代方法而不是查询字符串和GET - 会话变量,POST数据或完全不同的东西?
谢谢,MagicAndi.
问题:访问者打开网址http: //?i=133r534|213213 | 12312312,但此网址已无效,需要转发至website.com/#Videos:133r534|213213 | 012312312
我尝试过的:在过去的几个小时里,我尝试了许多使用Query_String的mod_rewrite(.htaccess)规则,都失败了.本主题中的最后一条消息显示了此问题的解决方案,但在我的情况下会有什么规则.
我很好奇你将如何解决这个问题:)!
我们正在审查系统的设计.并且需要验证我们认为可能是安全问题的内容.
在该系统中,一些敏感信息在查询字符串中发送.问题是:
可能重复:
如何将map转换为url查询字符串?
如何将Map转换为查询字符串?
例如:
MockHttpServletRequest request = getRequest();
HashMap<String, String> queryString = new HashMap<String, String>();
queryString.put("IDcontent", "4546446");
queryString.put("ID_CP", "604204d6-3ded-4882-9427-52f1ff8ee6c8");
request.setQueryString(mapToQueryString(queryString));
Run Code Online (Sandbox Code Playgroud)
我认为这是(mapToQueryString)做标准库,但我找不到它.
是否有任何选项qs.stringify,将不编码的网址吗?
$ node
> var qs = require("querystring");
undefined
> qs.stringify({"url": "http://domain.com"});
'url=http%3A%2F%2Fdomain.com'
Run Code Online (Sandbox Code Playgroud)
我想要下面的输出:
'url=http://domain.com'
Run Code Online (Sandbox Code Playgroud) 我想通过查询字符串传递两个参数cartid和productis.Cartid将从数据库中的会话(如果可用)生成,而Product将从先前的查询sting中获取
我的代码是(如果要从数据库中获取购物车ID)
CartInfo cartinfo = new CartInfo();
cartinfo.UserName = Session["UserName"].ToString();
cartinfo.IsOrder = "0";
cartinfo.CartDate = DateTime.Now;
int id = new InsertAction().InsertData(cartinfo);
if (id!=0)
{
lblmsg.Text = "Inserted Sucessfully";
Session["CartID"] = id;
if (Request.QueryString["ProductID"] != null)
{
int productid = int.Parse(Request.QueryString["ProductID"]);
}
Response.Redirect("ViewCartItems.aspx?CartID=id & ProductID=productid");
}
Run Code Online (Sandbox Code Playgroud)
如果要从创建的会话中获取cartid
if (Session["CartID"] != null)
{
string cartid;
int productid;
if (Request.QueryString["ProductID"] != null)
{
cartid = Session["CartID"].ToString();
productid = int.Parse(Request.QueryString["ProductID"]);
DataSet ds = new AddCartItem().GetCartItem(cartid, productid);
if (ds.Tables[0].Rows.Count > 0)
{
DataSet ds1 = …Run Code Online (Sandbox Code Playgroud) 考虑以下提取URL上传递的URLParam userId:
userId := http.Request.URL.Query().Get("userId")
Run Code Online (Sandbox Code Playgroud)
这是安全的(转义并准备在db调用中使用),或者我是否需要在使用之前将其转义/清理它?
query-string ×10
asp.net ×3
get ×3
.htaccess ×1
c# ×1
c#-4.0 ×1
go ×1
hashmap ×1
http-get ×1
https ×1
java ×1
junit ×1
mod-rewrite ×1
node.js ×1
php ×1
spring-mvc ×1
ssl ×1
url ×1
validation ×1
vb.net ×1