0

I have a website you can redirect to another website. But some links redirected with %E2%80%8E. But most sites redirected on the right way.

By debugging is see the following: item.Link gives "www.somesite.com/" and the link redirected "www.somesite.com/%E2%80%8E"

item.Link gives "www.mostsites.com/" and the link redirected "www.mostsites.com/"

What can be the problem? It's a MVC4 website with Razor technology.

<span class="label">@Html.DisplayNameFor(model => model.Organization)</span>
@{
  if (item.Link == null || item.Link == "")
  {
    <span>@Html.DisplayFor(modelItem => item.Organization)</span>
  }
  else
  {
    <span><a href="@Html.DisplayFor(modelItem => item.Link)" target="_blank">@Html.DisplayFor(modelItem => item.Organization)</a></span>
  }
}

I see as a solution like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*) index.php?model=$1&view=$2¶meters=$3 [L,NS]

But why do I have to place in my MVC application???

user1531040
  • 2,143
  • 6
  • 28
  • 48
  • This has nothing to do with MVC, those are non-printable characters which are copy-pasted from for example MS Word. See duplicate. If your question is _"How can I prevent this?"_, try sanitizing your input before saving it in the database, for example using string.Replace(). – CodeCaster Oct 30 '14 at 08:38
  • The data comes from a xml-file. You can see it as the "database". – user1531040 Oct 30 '14 at 08:40
  • Yeah well then clean it up before returning it from your controller. – CodeCaster Oct 30 '14 at 08:41
  • Okay I rewrite those 2 Link-elements. And now it works fine. So the problem has solved. Thanks. But where should I have to write that code. Do that makes my code better? – user1531040 Oct 30 '14 at 08:47
  • And I didn't use Word but VS2010. – user1531040 Oct 30 '14 at 08:49

0 Answers0