I recently detected, that UrlHelper.IsLocalUrl method always returns false, if it detects non-ASCII characters in the url parameter.
Example:
var isLocal = UrlHelper.IsLocalUrl("контакты"); //false
Is it a bug, or “by design”?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The latest available implementation is checking for those conditions:
"/"and is not followed by"/"or"\""~"and is followed by"/"Thus all the urls passed to this method must start with
"/"or"~/".Also, in case you wonder, it doesn’t take the current host into account and check for schemes like
httpfor instance.Update:
Here is a link to the implementation which is used by
UrlHelper.IsLocalUrlhttp://aspnetwebstack.codeplex.com/SourceControl/changeset/view/600963a4df15#src/System.Web.WebPages/RequestExtensions.cs