MVC QueryString с Guid возвращает 404
У меня проблема на моем сервере разработки .... На моей локальной машине все работает ....
Это проблема:
У меня есть страница, которая выглядит так:
@using Skipstone.Web;
@using Skipstone.Web.Providers;
@using Skipstone.Web.Extensions
@{
string id = (Request.QueryString["id"] == null) ? ProfileProvider.CurrentUser().UserId : Request.QueryString["id"];
Profile user = new Profile(id);
ViewBag.Title = "Profile - " + user.Surname + ", " + user.Forename;
string credentialId = (user.CredentialId != null && user.CredentialId != "") ? user.CredentialId : "Credential Id";
}
@if (id != null) {
@if (!string.IsNullOrEmpty(user.Photo))
{
<img src="@user.Photo">
}
else
{
<img src="/Content/media/user.png">
}
@user.Forename @user.Surname
@user.JobTitle
<p>@HtmlExtensions.decodeEscapedText(user.Bio)</p>
@if (id == ProfileProvider.CurrentUser().UserId)
{
<a href="#" class="button edit small" style="float: right;">Edit</a>
}
@if (user.Telephone != null && user.Telephone != "")
{ <span class="icon"></span><span>@user.Telephone</span> }
@if (user.Mobile != null && user.Mobile != "")
{ <span class="icon"></span><span>@user.Mobile</span> }
@if (user.Email != null && user.Email != "")
{ <span class="icon"></span><span><a href="mailto:@user.Email">@user.Email</a></span> }
@if (user.Twitter != null && user.Twitter != "")
{ <span class="icon"></span><span><a href="mailto:@user.Twitter">@user.Twitter</a></span> }
@if (user.Facebook != null && user.Facebook != "")
{ <span class="icon"></span><span><a href="mailto:@user.Facebook">@user.Facebook</a></span> }
@if (user.LinkedIn != null && user.LinkedIn != "")
{ <span class="icon"></span><span><a href="mailto:@user.LinkedIn">@user.LinkedIn</a></span> }
Title
Forname(s)
Surname
Username
Upload profile image
Job title
Telephone
Mobile
Email address
@if (SettingsProvider.CurrentSiteSettings().TwoFactorAuthentication)
{
Credential Id
}
else
{
}
LinkedIn
Twitter
Facebook
Bio
@user.Bio
Save
Cancel
}
else
{
throw new Exception("Invalid id specified.");
}
Теперь я получаю проблему ....
/ Профиль (Показать поля для текущего пользователя и работает нормально)
/ Profile? Id = 4 (состояния Guid должны содержать 32 цифры с 4 штрихами (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx))
/ Profile? Id = E23CB58D-BDBC-4BE5-A27C-7E6518ED72B0 (отображается ошибка 404 ...)
Я понятия не имею, почему Guid один не будет работать. Как я уже сказал, это работает на моей локальной машине, но неработать на сервере разработки. Я должен отметить, что ни одна страница, которая принимает строку guid, не работает, все они делают так же, как страница профиля ....
Кто-нибудь знает, почему это может происходить?
Обновить
Я изменил код на
@{
string id = Request.QueryString["id"];
}
@id
и я все еще получаю проблему
Обновление 2
Я изменил код на это:
@{
string id = (Request.QueryString["UserId"] == null) ? ProfileProvider.CurrentUser().UserId : Convert.ToString(Request.QueryString["UserId"]);
Profile user = new Profile(id);
ViewBag.Title = "Profile - " + user.Surname + ", " + user.Forename;
string credentialId = (user.CredentialId != null && user.CredentialId != "") ? user.CredentialId : "Credential Id";
}
потому что я подумал, что это может быть проблема с попыткой использовать Id / id в качестве параметра. Во всяком случае, я все еще получаю ту же проблему ....