I am getting "Internet Explorer cannot display the webpage" error while trying to redirect ot another page.
string targetURL = "~/AnotherForm.aspx?Xresult=" + HttpUtility.UrlEncode(res);
Response.Redirect(targetURL);
Thanks
BB
ResolveURL() which is used by Response.Redirect(), doesn't work nicely with UrlEncode, try this:
string targetURL = "~/AnotherForm.aspx?Xresult=" + HttpUtility.UrlEncode(res);
Also check this related SO answer: Response.Redirect using ~ Path
You're miscalling HttpUtility.UrlEncode.
You should only Encode the parameter value.
By Encodeing the entire URL, you are escaping the / characters, messing up your URL.
Related
I have the following line of aspx link that I would like to encode:
Response.Redirect("countriesAttractions.aspx?=");
I have tried the following method:
Response.Redirect(Encoder.UrlPathEncode("countriesAttractions.aspx?="));
This is another method that I tried:
var encoded = Uri.EscapeUriString("countriesAttractions.aspx?=");
Response.Redirect(encoded);
Both redirects to the page without the URL being encoded:
http://localhost:52595/countriesAttractions?=
I tried this third method:
Response.Redirect(Server.UrlEncode("countriesAttractions.aspx?="));
This time the url itself gets encoded:
http://localhost:52595/countriesAttractions.aspx%3F%3D
However I get an error from the UI saying:
HTTP Error 404.0 Not Found
The resource you are looking for has been removed, had its name changed, or
is temporarily unavailable.
Most likely causes:
-The directory or file specified does not exist on the Web server.
-The URL contains a typographical error.
-A custom filter or module, such as URLScan, restricts access to the file.
Also, I would like to encode another kind of URL that involves parsing of session strings:
Response.Redirect("specificServices.aspx?service=" +
Session["service"].ToString().Trim() + "&price=" +
Session["price"].ToString().Trim()));
The method I tried to include the encoding method into the code above:
Response.Redirect(Server.UrlEncode("specificServices.aspx?service=" +
Session["service"].ToString().Trim() + "&price=" +
Session["price"].ToString().Trim()));
The above encoding method I used displayed the same kind of results I received with my previous Server URL encode methods. I am not sure on how I can encode url the correct way without getting errors.
As well as encoding URL with CommandArgument:
Response.Redirect("specificAttractions.aspx?attraction=" +
e.CommandArgument);
I have tried the following encoding:
Response.Redirect("specificAttractions.aspx?attraction=" +
HttpUtility.HtmlEncode(Convert.ToString(e.CommandArgument)));
But it did not work.
Is there any way that I can encode the url without receiving this kind of error?
I would like the output to be something like my second result but I want to see the page itself and not the error page.
I have tried other methods I found on stackoverflow such as self-coded methods but those did not work either.
I am using AntiXSS class library in this case for the methods I tried, so it would be great if I can get solutions using AntiXSS library.
I need to encode URL as part of my school project so it would be great if I can get solutions. Thank you.
You can use the UrlEncode or UrlPathEncode methods from the HttpUtility class to achieve what you need. See documentation at https://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode(v=vs.110).aspx
It's important to understand however, that you should not need to encode the whole URL string. It's only the parameter values - which may contain arbitrary data and characters which aren't valid in a URL - that you need to encode.
To explain this concept, run the following in a simple .NET console application:
string url = "https://www.google.co.uk/search?q=";
//string url = "http://localhost:52595/specificAttractions.aspx?country=";
string parm = "Bora Bora, French Polynesia";
Console.WriteLine(url + parm);
Console.WriteLine(url + HttpUtility.UrlEncode(parm), System.Text.Encoding.UTF8);
Console.WriteLine(url + HttpUtility.UrlPathEncode(parm), System.Text.Encoding.UTF8);
Console.WriteLine(HttpUtility.UrlEncode(url + parm), System.Text.Encoding.UTF8);
You'll get the following output:
https://www.google.co.uk/search?q=Bora Bora, French Polynesia
https://www.google.co.uk/search?q=Bora+Bora%2c+French+Polynesia
https://www.google.co.uk/search?q=Bora%20Bora,%20French%20Polynesia
https%3a%2f%2fwww.google.co.uk%2fsearch%3fq%3dBora+Bora%2c+French+Polynesia
By pasting these into a browser and trying to use them, you'll soon see what is a valid URL and what is not.
(N.B. when pasting into modern browsers, many of them will URL-encode automatically for you, if your parameter is not valid - so you'll find the first output works too, but if you tried to call it via some C# code for instance, it would fail.)
Working demo: https://dotnetfiddle.net/gqFsdK
You can of course alter the values you input to anything you like. They can be hard-coded strings, or the result of some other code which returns a string (e.g. fetching from the session, or a database, or a UI element, or anywhere else).
N.B. It's also useful to clarify that a valid URL is simply a string in the correct format of a URL. It is not the same as a URL which actually exists. A URL may be valid but not exist if you try to use it, or may be valid and really exist.
I'm trying to do some work with fakemailgenerator, the url goes well with httpwebrequest and gets printed by MessageBox.Show properly, here is the piece of code with the problem, btw there no errors or exeptions.
//FOR EXAMPLE mail#fakemail.com
string[] mailSplit = mail.Split(new string[] { "#" },
StringSplitOptions.None); // MAKING AN ARRAY TO SPLIT USER
AND DOMAIN
string url = #"http://www.fakemailgenerator.com/#/" +
mailSplit[1] + "/" + mailSplit[0] + "/"; //GENERATING AND SAVING THE FAKE MAIL URL.
MessageBox.Show(url); //THIS PRINTS http://www.fakemailgenerator.com/#/fakemail.com/mail
Process.Start("chrome", url); //THIS GOES TO http://www.fakemailgenerator.com/#/fakemail.com
EDIT
This have nothing to do with fakemailgenerator.com, because as mentioned above i tried that with httpwebrequest, plus in the loading state it's just http://www.fakemailgenerator.com/#/fakemail.com and not the full url.
EDIT
I tried rightnow putting the url manually and it went good and have been opened in chrome successfully, and i have observed one problem with the url when printed with MessageBox.Show (while using variables, not setting url manually), is showing url like http://www.fakemailgenerator.com/#/domain.com /userwith a whitespace between .com and /user, so i've tried replacing the white space with \0 (null) using url.Replace(' ','\0'), but this failed, so i think maybe there is a way to remove the white space?
Ran the code and it worked fine. A new Chrome window opened with the correct (full) url. It's an error page for me though, but if the site really exists when you try to reach it, perhaps there is some kind of a redirect that redirects you to a site with the shorter url.
I've figured around the problem, i don't really know where it's coming from, but all i know is that a whitespace was being added to the url in a way that makes process.Start("chrome",url); receives only the part before the whitespace; http://www.fakemailgenerator.com/#/domain.com/ , so i've just removed the whitespace with url = url.Replace(" ",string.Empty); and now the code works just fine.
On my IIS7 I have ASP.NET WebForms site, and I use cyrillic values in the query string. I use HttpUtility.UrlEncode for params when do redirect, in the end I have url like:
http://mysite.com/Search.aspx?SearchText=текст
When I try to read param SearchText value (include HttpUtility.Decode() function) it returns me a wrong value of ÑекÑÑ, but should return текст
It works on localhost on ASP.NET developer server, but doesn't on IIS7 (include local IIS7)
In my web.config I set up line
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
but it still doesn't work.
Appreciate any help,
Thanks a lot!
Problem actually was in UrlRewriting.net that I use in my web-application.
I solved the same problem by converting the value to ToBase64String:
Before redirecting to a target page I encoded the value:
Dim Data() As Byte 'For the data to be encoded
'Convert the string into a byte array
Dim encoding As New System.Text.UTF8Encoding
Data = encoding.GetBytes(ParamToPass)
'Converting to ToBase64String
Dim EncodedStringToPass as string = Convert.ToBase64String(Data)
Page.Response.Redirect("TargetPage.aspx?Param=" & EncodedStringToPass, False)
At the target page:
Dim Data() As Byte 'For the data to be decoded
Data = Convert.FromBase64String(Page.Request.Params("Param"))
Dim encoding As New System.Text.UTF8Encoding
Dim ParamToPass As String = encoding.GetString(Data)
P.S. The only disadvantage of the method is that one cannot see the real value of the parameters in url string of browsers. But in my case this made no problem
If you use the redirect function, yes inside it there is this call
url = UrlEncodeRedirect(url);
thats break the Cyrilic, Greece characters and probably others. If I remember well, (I say remember because this issue is from my experience some months ago) the break to the characters is after the ? symbol. In any case I have the same issue.
Possible solutions:
Make your custom redirect, maybe not so good as the original, but you can by pass this issue.
Find some alternative way to your redirect logic.
Make your custom text encode that use only valid url characters that are not change by the redirect, and then decodes them again back. The minous on that is that will be like hidden text and not visible readable search word.
This is the very basic of the redirect.
public static void RedirectSimple(string url, bool endResponse)
{
HttpResponse MyResponse = HttpContext.Current.Response;
MyResponse.Clear();
MyResponse.TrySkipIisCustomErrors = true;
MyResponse.StatusCode = 302;
MyResponse.Status = "302 Temporarily Moved";
MyResponse.RedirectLocation = url;
MyResponse.Write("<html><head><title>Object moved</title></head><body>\r\n");
MyResponse.Write("<h2>Object moved to here.</h2>\r\n");
MyResponse.Write("</body></html>\r\n");
if (endResponse){
MyResponse.End();
}
}
You can make it a function and try it to see if works correctly.
I'm using Response.Redirect() to pass data (containing HTML) from one page to another. This works fine in Google Chrome but in Internet Explorer it said: "Couldn't find page!"
Does someone know what this is?
Thank you in advance
This is the URL:
string url = "Detailscherm.aspx?"
+ "melder=" + Server.UrlEncode(gv.SelectedRow.Cells[1].Text)
+ "&onderwerp=" + Server.UrlEncode(gv.SelectedRow.Cells[2].Text)
+ "&omschrijving=" + Server.UrlEncode(lblOmschrijving.Text)
+ "&fasedatum=" + Server.UrlEncode(gv.SelectedRow.Cells[4].Text)
+ "&outlookid=" + Server.UrlEncode(lblOutlookID.Text)
+ "&status=" + Server.UrlEncode(status)
+ "&niv1=" + Server.UrlEncode("")
+ "&niv2=" + Server.UrlEncode("");
Response.Redirect(url);
lblOmschrijving is a label which contains HTML-code
this is the value of URL right before Redirect:
"Detailscherm.aspx?melder=EBE&onderwerp=Test+feedback&omschrijving=%3chtml+xmlns%3ao%3d%22urn%3aschemas-microsoft-com%3aoffice%3aoffice%22+xmlns%3aw%3d%22urn%3aschemas-microsoft-com%3aoffice%3aword%22+xmlns%3d%22http%3a%2f%2fwww.w3.org%2fTR%2fREC-html40%22%3e%0d%0a%3chead%3e%0d%0a%3cmeta+http-equiv%3d%22Content-Type%22+content%3d%22text%2fhtml%3b+charset%3dutf-8%22%3e%0d%0a%3cmeta+name%3d%22Generator%22+content%3d%22Microsoft+Word+11+(filtered+medium)%22%3e%0d%0a%3cstyle%3e%0d%0a%3c!--%0d%0a+%2f*+Style+Definitions+*%2f%0d%0a+p.MsoNormal%2c+li.MsoNormal%2c+div.MsoNormal%0d%0a%09%7bmargin%3a0cm%3b%0d%0a%09margin-bottom%3a.0001pt%3b%0d%0a%09font-size%3a12.0pt%3b%0d%0a%09font-family%3a%22Times+New+Roman%22%3b%7d%0d%0aa%3alink%2c+span.MsoHyperlink%0d%0a%09%7bcolor%3ablue%3b%0d%0a%09text-decoration%3aunderline%3b%7d%0d%0aa%3avisited%2c+span.MsoHyperlinkFollowed%0d%0a%09%7bcolor%3apurple%3b%0d%0a%09text-decoration%3aunderline%3b%7d%0d%0aspan.E-mailStijl17%0d%0a%09%7bmso-style-type%3apersonal-compose%3b%0d%0a%09font-family%3aArial%3b%0d%0a%09color%3awindowtext%3b%7d%0d%0a%40page+Section1%0d%0a%09%7bsize%3a595.3pt+841.9pt%3b%0d%0a%09margin%3a70.85pt+70.85pt+70.85pt+70.85pt%3b%7d%0d%0adiv.Section1%0d%0a%09%7bpage%3aSection1%3b%7d%0d%0a--%3e%0d%0a%3c%2fstyle%3e%0d%0a%3c%2fhead%3e%0d%0a%3cbody+lang%3d%22NL%22+link%3d%22blue%22+vlink%3d%22purple%22%3e%0d%0a%3cdiv+class%3d%22Section1%22%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3eMohamed%2c%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3e%3co%3ap%3e%26nbsp%3b%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3eIk+heb+zonet+enkele+zaken+getest.+De+testfeedback+is+opgenomen+in+de+bijlage.%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3e%3ca+href%3d%22file%3a%2f%2f%2f%5c%5cJUPITER%5cInformatica%5cProjecten%5cIntegratie%2520SLA%2520rapportering%2520op%2520IT%2520Helpdesk%2520mailbox%5c6.%2520Test%2520en%2520Training%5cTesten%2520Integratie%2520helpdesk%2520sla-%2520Opmerkingen.xls%22%3eO%3a%5cProjecten%5cIntegratie%0d%0a+SLA+rapportering+op+IT+Helpdesk+mailbox%5c6.+Test+en+Training%5cTesten+Integratie+helpdesk+sla-+Opmerkingen.xls%3c%2fa%3e%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3e%3co%3ap%3e%26nbsp%3b%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3eWe+zullen+hier+vanmiddag+samen+naar+kijken.%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3e%3co%3ap%3e%26nbsp%3b%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3eGroeten%2c%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3e%3co%3ap%3e%26nbsp%3b%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3eEric%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%222%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3b%0d%0afont-family%3aArial%22%3e%3co%3ap%3e%26nbsp%3b%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a9.0pt%3b%0d%0afont-family%3aArial%3blayout-grid-mode%3aline%22%3e__________________________________________%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Times+New+Roman%22%3e%3cspan+style%3d%22font-size%3a%0d%0a9.0pt%3blayout-grid-mode%3aline%22%3e%3co%3ap%3e%26nbsp%3b%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a9.0pt%3b%0d%0afont-family%3aArial%3blayout-grid-mode%3aline%22%3eEric+Op+de+Beeck%3c%2fspan%3e%3c%2ffont%3e%3cspan+style%3d%22layout-grid-mode%3aline%22%3e%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a9.0pt%3b%0d%0afont-family%3aArial%3blayout-grid-mode%3aline%22%3eAfdelingshoofd+Informatica%3c%2fspan%3e%3c%2ffont%3e%3cfont+size%3d%222%22%3e%3cspan+style%3d%22font-size%3a10.0pt%3blayout-grid-mode%3aline%22%3e%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a9.0pt%3b%0d%0afont-family%3aArial%3blayout-grid-mode%3aline%22%3e%3ca+href%3d%22mailto%3aEric.Op.de.Beeck%40etaplighting.com%22+title%3d%22mailto%3aEric.Op.de.Beeck%40etaplighting.com%22%3eEric.Op.de.Beeck%40etaplighting.com%3c%2fa%3e%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Times+New+Roman%22%3e%3cspan+style%3d%22font-size%3a%0d%0a9.0pt%3blayout-grid-mode%3aline%22%3e%3co%3ap%3e%26nbsp%3b%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a9.0pt%3b%0d%0afont-family%3aArial%3blayout-grid-mode%3aline%22%3eAntwerpsesteenweg+130+-+B-2390+Malle%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a9.0pt%3b%0d%0afont-family%3aArial%3blayout-grid-mode%3aline%22%3eTel.+03+310+02+11+-+Fax+03+311+61+42%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+lang%3d%22EN-GB%22+style%3d%22font-size%3a%0d%0a9.0pt%3bfont-family%3aArial%3bletter-spacing%3a.5pt%3blayout-grid-mode%3aline%22%3eBTW+BE+0424+980+655+RPR+Antwerpen%3c%2fspan%3e%3c%2ffont%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+lang%3d%22EN-GB%22+style%3d%22font-size%3a9.0pt%3bfont-family%3aArial%3blayout-grid-mode%3aline%22%3e%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cu%3e%3cfont+size%3d%221%22+color%3d%22blue%22+face%3d%22Arial%22%3e%3cspan+lang%3d%22EN-GB%22+style%3d%22font-size%3a9.0pt%3bfont-family%3aArial%3bcolor%3ablue%3blayout-grid-mode%3aline%22%3ewww.etaplighting.com%3c%2fspan%3e%3c%2ffont%3e%3c%2fu%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+lang%3d%22EN-GB%22+style%3d%22font-size%3a9.0pt%3bfont-family%3aArial%3b%0d%0alayout-grid-mode%3aline%22%3e%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a9.0pt%3b%0d%0afont-family%3aArial%3blayout-grid-mode%3aline%22%3e__________________________________________%3c%2fspan%3e%3c%2ffont%3e%3cfont+size%3d%221%22+face%3d%22Arial%22%3e%3cspan+style%3d%22font-size%3a9.0pt%3bfont-family%3aArial%3blayout-grid-mode%3a%0d%0aline%22%3e%3co%3ap%3e%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3cp+class%3d%22MsoNormal%22%3e%3cfont+size%3d%223%22+face%3d%22Times+New+Roman%22%3e%3cspan+style%3d%22font-size%3a%0d%0a12.0pt%22%3e%3co%3ap%3e%26nbsp%3b%3c%2fo%3ap%3e%3c%2fspan%3e%3c%2ffont%3e%3c%2fp%3e%0d%0a%3c%2fdiv%3e%0d%0a%3c%2fbody%3e%0d%0a%3c%2fhtml%3e%0d%0a&fasedatum=21%2f03%2f2011+12%3a08%3a13&outlookid=AAMkAGI2MGM0NjY2LTI5MGYtNGVmMC1iMTg2LThlZDNmODFhZDIwNQBGAAAAAAC5W4YdHHPkSL1VgU1WnUztBwD2It7i8bOLTI4%2fH%2bc6MwEsAC0BCIilAAD2It7i8bOLTI4%2fH%2bc6MwEsAC0M%2b0T9AAA%3d&status=0&niv1=&niv2="
The length of the querystring is too long. I.E. Only accepts up to 2083 characters. Chrome and others do not. I have had a similar problem.
Try using Server.Transfer(), or put the variables in session or post a form.
Session["melder"] = Server.UrlEncode(gv.SelectedRow.Cells[1].Text);
Session["onderwerp"] = Server.UrlEncode(gv.SelectedRow.Cells[2].Text);
...
Response.Redirect("Detailscherm.aspx");
You can then fetch these values back on that page
string melder = Session["melder"];
Session["melder"] = "";
In any case, it does not seem like a very good idea to put all that data in a querystring. If anyone changes the values in the address bar, it could make your pages show incorrect data.
Try using sessions, or Post to carry large amounts of data across pages.
try this
string value = "../containing html";
Response.Redirect("http://www.mysite.com/?Value=" + Server.UrlEncode(value));
HTTP Get length, that Google Chrome and Internet Explorer supports is different.
IE only support 2083 characters.
Google Chrome support 8182 characters.
Safari Browser support 80,000.
Opera Browser support 190,000.
This might sound like a trivial problem but for some reason it is not.
Instead of needing to redirect
Response.Redirect("~/folder1/folder2/some.aspx")
I need the location as if it behaved like
string navigatingUrl = Response.Redirect("~/folder1/folder2/some.aspx")
Trying to replicate this I started with
string navigatingUrl = new Uri(HttpContext.Current.Request.Url,
new Uri("~/folder1/folder2/some.aspx", UriKind.Relative));
This instead generates "http://www.fullRequestUrl/~/folder1/folder2/some.aspx"
Edit: Well I've found out why I absolutely hate the URL API from Microsoft. I wish hellfire to whoever wrote this line of code
else if (uriKind == UriKind.Relative)
{
// Here we know that we can create an absolute Uri, but the user has requested
only a relative one
e = GetException(ParsingError.CannotCreateRelative);
}
What would possess someone to throw an error like that? This single if statement completely destroys the API.
I think you are looking for Control.ResolveUrl(). Typically you would probably use the method found on your Page object (if you are using WebForms).
Stealing from Get absolute url for a file in my asp.net project to include HTTP// etc for use externally? the only absolute way to do this is:
string url = Request.Url.GetLeftPart(UriPartial.Authority)
+ VirtualPathUtility.ToAbsolute(relativePath)
Response.Redirect(Page.ResolveUrl("~/folder1/forlder2/some.aspx"), false);