为了保护Web应用程序免受查询字符串操作,我正在考虑向每个url添加一个查询字符串参数,该参数存储所有其他查询字符串参数和值的SHA1哈希值,然后根据每个请求的哈希值进行验证.
此方法是否提供强大的保护,防止用户操纵查询字符串值?这样做还有其他任何缺点/副作用吗?
我并不特别关注这个私人网络应用程序的"丑陋"网址.由于对于相同的查询字符串参数,哈希值始终相同,因此Url仍然是"可收藏"的.
这是一个ASP.NET应用程序.
我如何发送带有&的字符串(例如:google&facebook)作为查询字符串值?现在
var strUrl="ajaxpage.aspx?subject=my subject line &cmnt=google & facebook";
strUrl = encodeURI(strUrl);
$.ajax({ url: strUrl, success: function (data) {
alert(data)
}
});
Run Code Online (Sandbox Code Playgroud)
现在当我读取查询字符串"cmnt"时,我只得到"谷歌",因为它打破了&
这是什么解决方法?谢谢
/search.aspx?Search=test
function getQuery(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
};
if (getQuery('SearchType') == '') {
$("#txtSearch").val(getQuery('Search'));
};
Run Code Online (Sandbox Code Playgroud)
如果我省略if语句并只设置文本框的值它工作正常,所以我显然知道我的getQuery函数正在工作.这显然与SearchType不是'的事实有关,它不是什么.我试过"if(getQuery('SearchType'))但是这也不起作用.
必须是一个简单的答案...总有我的问题:)
我想从URL获取查询字符串的所有参数的值。
例: www.xyz.com?author=bloggingdeveloper&a1=hello
我想使用JavaScript 获取author和的值a1。
是否可以在ac#asp.net站点的查询字符串中安全地包含密码.
我知道的一些假设和事情 -
我知道该网站可能容易受到跨站点脚本和重放攻击.我该如何减轻这些?
鉴于上述情况,我应该如何在查询字符串中包含密码?
请不要问我'为什么',我知道这不是一个好主意,但它是客户想要的.
我有这样的网址:
http://localhost:9562/Account/LogOn?ReturnUrl=%2fCabinet%2fCabinet
Run Code Online (Sandbox Code Playgroud)
我需要解析它:
Cabinet/Cabinet
Run Code Online (Sandbox Code Playgroud)
我想从一个ctroller传递7个查询字符串值到另一个控制器动作.
在我的旧应用程序中,我将这些值传递给URL中的查询字符串.
现在,在MVC 4中,请建议我如何包含"RedirecttoAction"或其他任何方式?
我正在发送此请求
curl -XGET 'host/process_test_3/14/_search' -d '{
"query" : {
"query_string" : {
"query" : "\"*cor interface*\"",
"fields" : ["title", "obj_id"]
}
}
}'
Run Code Online (Sandbox Code Playgroud)
而且我得到了正确的结果
{
"took": 12,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 5.421598,
"hits": [
{
"_index": "process_test_3",
"_type": "14",
"_id": "141_dashboard_14",
"_score": 5.421598,
"_source": {
"obj_type": "dashboard",
"obj_id": "141",
"title": "Cor Interface Monitoring"
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我想通过单词部分搜索时,例如
curl -XGET 'host/process_test_3/14/_search' -d '
{
"query" : { …Run Code Online (Sandbox Code Playgroud) 如何在Thymeleaf中创建URL:
/user/map?userId=1&mapId=2
Run Code Online (Sandbox Code Playgroud)
在百里香模型中,我可以访问$ {user.id}和$ {map.id}。
我试过了:
th:href="@{'/user/map/update/?userId=' + ${user.id} + '&mapId=' + ${map.id}}"
Run Code Online (Sandbox Code Playgroud)
但它给出:
The reference to entity "mapId" must end with the ';' delimiter.
Run Code Online (Sandbox Code Playgroud) Python3 urllib.parse.parse_qs奇怪地返回string, list<string>查询字符串的字典:
>>> import urllib.parse as p
>>> url = p.urlparse("http://exam.ple/path?query=string&yes=no")
ParseResult(scheme='http', netloc='exam.ple', path='/path', params='', query='query=string&yes=no', fragment='')
>>> p.parse_qs(url.query)
{'query': ['string'], 'yes': ['no']}
Run Code Online (Sandbox Code Playgroud)
该函数的文档说:
字典键是唯一的查询变量名称,而值是每个名称的值列表。
我可以以某种方式利用此“值列表”功能吗?
无论是维基百科,也不堆栈溢出,也不IETF规范有关“多”或字段的值“列表”提任何东西,我找不到任何这样的语法:
>>> p.parse_qs(p.urlparse("http://exam.ple/path?query=string&yes=no/a=0").query)
{'query': ['string'], 'yes': ['no/a=0']}
>>> p.parse_qs(p.urlparse("http://exam.ple/path?query=string@yes=no").query)
{'query': ['string@yes=no']}
>>> p.parse_qs(p.urlparse("http://exam.ple/path?query=string;yes=no").query)
{'query': ['string'], 'yes': ['no']}
>>> p.parse_qs(p.urlparse("http://exam.ple/path?query=string,yes=no").query)
{'query': ['string,yes=no']}
Run Code Online (Sandbox Code Playgroud)
似乎没有分隔符会导致键的值包含多个字符串。可能吗?
query-string ×10
asp.net ×3
c# ×2
javascript ×2
jquery ×2
asp.net-mvc ×1
c#-4.0 ×1
encryption ×1
hash ×1
passwords ×1
python ×1
security ×1
standards ×1
thymeleaf ×1
urllib ×1