在我正在构建的网站中,我们需要大量的动态重定向,以保持网站各部分的流量.
我目前正在使用response.redirect来实现这一点,重定向URL是在各种按钮的回发方法后面的代码中动态生成的.
这种情况在95%的情况下都很好,但是我注意到有时URL会被严重损坏.
在一种情况下,url是URLEncoded,因为其中一个参数有时包含&符号,但重定向忽略了这一点并重定向到非编码版本.
即"page.aspx?qs = first%26second&qs = 2&qs = 3"被重定向到"page.aspx?qs = first&second&qs = 2&qs = 3"
发生的另一种情况是响应完全被剥去了&符号,导致频繁崩溃.
即"page.aspx?qs = 1&qs = 2&qs = 3"被重定向到"page.aspx?qs = 1qs = 2qs = 3"
有没有人有任何想法为什么会出现这些情况?
解决
对不起,这是由于我自己的白痴,从管理员重定向到非管理员(不要问),而不是在几页上再次将&s重新输入或url编码.
(捂脸)
我有一个HTML表单,必须发布到URL.我希望表单POST一个名为DATA的变量,如下所示:
DATA: somevar=someval&somevar2=someotherval
Run Code Online (Sandbox Code Playgroud)
我在做这件事时遇到了麻烦.默认情况下,表示urlencode数据,导致:
DATA: somevar%3Dsomeval%26somevar2%3Dsomeotherval
Run Code Online (Sandbox Code Playgroud)
将表单的enc-type更改为"text/plain"会导致:
DATA: somevar=someval
SOMEVAR2: someotherval
Run Code Online (Sandbox Code Playgroud)
有什么方法可以让表格实际上只是发送上面的数据?
我想使用PHP 将包含拉丁字符(如à)的URL编码为ISO-8859-1 .
编码的字符串将用于执行对Web服务的请求.因此,如果请求是:
http://www.mywebservice.com?param =à
编码的字符串应该是:
http://www.mywebservice.com?param=%E0
我尝试过使用PHP的函数urlencode(),但它返回以UTF-8编码的输入:
我试图发送一个简单的HTTP请求,如下所示:
var client = new WebClient();
string myString="this is the string i want to send";
message = client.DownloadString("http://www.viralheat.com/api/sentiment/review.xml?text=" + myString + "&api_key="+currentKey);
Run Code Online (Sandbox Code Playgroud)
但是我发送的一些字符串包括#或&或者这样的字符,所以我想在发送之前先对字符串进行编码,因为如果它包含这些特殊字符而不进行编码会引发错误.
我有一个URL字符串,其中有换行符和回车符.例如
http://xyz.com/hello?name=john&msg=hello\nJohn\n\rgoodmorning¬e=last\night I went to \roger
Run Code Online (Sandbox Code Playgroud)
我的实际msg字符串是:
hello
john
goodmorning
Run Code Online (Sandbox Code Playgroud)
和note字符串是
last\night I went to \roger
Run Code Online (Sandbox Code Playgroud)
为了正确发送它我必须urlencode这个
http://xyz.com/hello?name%3Djohn%26msg%3Dhello%5CnJohn%5Cn%5Crgoodmorning%26note%3Dlast%5Cnight%20I%20went%20to%20%5Croger
Run Code Online (Sandbox Code Playgroud)
但这个编码搞乱\n和\ r.虽然我希望\n应该转换为%0A和\ r转换为%0D
我写的代码是ruby.我试图帮助Addressable::URI但没有帮助.其他方式可以分别手动将\n和\ r \n替换为%0A和%0D.但是,置换能代替有效的字符,如last\night到last%0Aight,我不想要的.有谁能建议更好的解决方案?谢谢.
我有这个代码存根:
System.out.println(param+"="+value);
param = URLEncoder.encode(param, "UTF-8");
value = URLEncoder.encode(value, "UTF-8");
System.out.println(param+"="+value);
Run Code Online (Sandbox Code Playgroud)
这在Eclipse中给出了这个结果:
p=???
p=%E6%8C%87%E7%94%B2%E6%B2%B9
Run Code Online (Sandbox Code Playgroud)
但是当我从命令行运行相同的代码时,我得到以下输出:
p=???
p=%C3%8A%C3%A5%C3%A1%C3%81%C3%AE%E2%89%A4%C3%8A%E2%89%A4%CF%80
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?
这看起来应该很简单,但我很难搞清楚.我想发送wget类似如下的请求,
wget http://www.foo.com/bar.cgi?param=\"p\"
Run Code Online (Sandbox Code Playgroud)
但我不希望它对引号进行URL编码(或其他任何事情).这可能吗?
为了说清楚,我是a)处理一个没有URL解码的服务器 - 我无能为力 - 并且b)意识到我可以用Python脚本或Burp,或者许多其他的事情.我只需要知道是否wget可以做到.
谢谢!
我有一种感觉,我只是在看这个错误,但我希望通过Angular的$ http.get()方法获得有关传递URL查询参数的正确方法的反馈 - 特别是包含逗号的参数.
假设我有以下数据,用作GET请求中的URL参数:
var params = {
filter : [
"My filter",
"My other filter",
"A filter, that contains, some commas"
],
sort : [
"ascending"
]
};
Run Code Online (Sandbox Code Playgroud)
现在,我将此结构转换为可以输入的一些参数$http.get:
var urlParams = {};
angular.forEach(params, function(value, name) {
urlParams[name] = "";
for (var i = 0; i < value.length; i++) {
urlParams[name] += value[i];
if (i < value.length - 1) {
urlParams[name] += ","
}
}
}
Run Code Online (Sandbox Code Playgroud)
此时,urlParams看起来像这样:
{
filter : "My filter,My other filter,A …Run Code Online (Sandbox Code Playgroud) 我得到的网址包含amp;。有什么办法可以删除它,因为我目前正在尝试使用此URLDecode功能,但是它不起作用。我是否需要使用简单的字符串替换将其删除?或者有更好的方法吗?
我在网上寻找一个简单的小加密方法,它会接受一个字符串,加密它,然后解密它.我的想法是,我需要一个不能在计划文本中的URL.
我发现的课程大部分时间都很有用,但有时候,我最终会得到一个带有/的加密字符串:
OSprnGR/0os4DQpQsa0gIg==
Run Code Online (Sandbox Code Playgroud)
可以想象,这在URL中使用时会导致问题.所以我认为,如果我只是UrlEncode字符串,它将解决问题.
它没有.
即使URL看起来像这样,我仍然会得到相同的错误:
http://localhost:54471/BrokerDashboard/BuyingLeads/LeadView/OSprnGR%2f0os4DQpQsa0gIg%3d%3d
Run Code Online (Sandbox Code Playgroud)
而不是这个:
http://localhost:54471/BrokerDashboard/BuyingLeads/LeadView/OSprnGR/0os4DQpQsa0gIg==
Run Code Online (Sandbox Code Playgroud)
HTTP错误404.0 - 未找到您要查找的资源已被删除,名称已更改或暂时不可用.
这是我正在使用的课程:
public static class Encryption
{
public static string keyString { get { return "6C3A231C-57B2-4BA0-AFD6-306098234B11"; } }
private static byte[] salt = Encoding.ASCII.GetBytes("somerandomstuff");
public static string Encrypt(string plainText)
{
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(keyString, salt);
MemoryStream ms = new MemoryStream();
StreamWriter sw = new StreamWriter(new CryptoStream(ms, new RijndaelManaged().CreateEncryptor(key.GetBytes(32), key.GetBytes(16)), CryptoStreamMode.Write));
sw.Write(plainText);
sw.Close();
ms.Close();
string beforeUrlEncoded = Convert.ToBase64String(ms.ToArray());
string afterUrlEndcoded = HttpUtility.UrlEncode(beforeUrlEncoded);
return afterUrlEndcoded;
}
public static string Decrypt(string …Run Code Online (Sandbox Code Playgroud) url-encoding ×10
c# ×3
.net ×1
angularjs ×1
asp.net-mvc ×1
encoding ×1
encryption ×1
forms ×1
html ×1
http ×1
iso-8859-1 ×1
java ×1
javascript ×1
php ×1
redirect ×1
ruby ×1
url ×1
urldecode ×1
urlencode ×1
vbscript ×1
wget ×1