0

我的开发服务器有问题....在我的本地机器上一切正常....

这是问题:

我有一个看起来像这样的页面:

@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) {
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>

    <div class="container">
        <div class="row">
            <div class="sixcol">
                <div class="profile">
                    @if (!string.IsNullOrEmpty(user.Photo))
                    {
                        <img src="@user.Photo" />
                    }
                    else
                    {
                        <img src="/Content/media/user.png" />
                    }
                    <h2>@user.Forename @user.Surname</h2>
                    <h3>@user.JobTitle</h3>
                    <p>@HtmlExtensions.decodeEscapedText(user.Bio)</p>
                </div>
            </div>
        </div>
    </div>

    <div class="container">
        <div class="row">
            <div class="sixcol">
                <div class="message"></div>
            </div>
            <div class="sixcol">
            </div>
        </div>
    </div> 

    <div class="container" id="profile-view">
        <div class="row">
            <div class="sixcol">
                <div class="profile form">
                    @if (id == ProfileProvider.CurrentUser().UserId)
                    {
                        <a href="#" class="button edit small" style="float: right;">Edit</a>
                    }
                    <ul>
                        @if (user.Telephone != null && user.Telephone != "")
                        { <li class="profile-tel"><span class="icon"></span><span>@user.Telephone</span></li> }
                        @if (user.Mobile != null && user.Mobile != "")
                        { <li class="profile-mob"><span class="icon"></span><span>@user.Mobile</span></li> }
                        @if (user.Email != null && user.Email != "")
                        { <li class="profile-email"><span class="icon"></span><span><a href="mailto:@user.Email">@user.Email</a></span></li> }
                    </ul>
                    <ul>
                        @if (user.Twitter != null && user.Twitter != "")
                        { <li class="profile-twitter"><span class="icon"></span><span><a href="mailto:@user.Twitter">@user.Twitter</a></span></li> }
                        @if (user.Facebook != null && user.Facebook != "")
                        { <li class="profile-facebook"><span class="icon"></span><span><a href="mailto:@user.Facebook">@user.Facebook</a></span></li> }
                        @if (user.LinkedIn != null && user.LinkedIn != "")
                        { <li class="profile-linked"><span class="icon"></span><span><a href="mailto:@user.LinkedIn">@user.LinkedIn</a></span></li> }
                    </ul>
                </div>
            </div>
            <div class="sixcol"></div>
        </div>
    </div> 

    <form id="profile-edit" style="display: none;">
        <div class="container">
            <div class="row">
                <div class="sixcol">
                    <div class="form form-top form-bottom">                    
                        <input type="hidden" id="UserId" name="UserId" value="@user.UserId" />
                        <input type="hidden" id="CompanyName" name="CompanyName" value="@user.CompanyName" />
                        <input type="hidden" id="Photo" name="Photo" value="@user.Photo" />
                        <input type="hidden" id="UserCanEdit" name="UserCanEdit" value="@user.UserCanEdit" />
                        <input type="hidden" id="UserCanEditOwn" name="UserCanEditOwn" value="@user.UserCanEditOwn" />
                        <input type="hidden" id="UserCanApprove" name="UserCanApprove" value="@user.UserCanApprove" />
                        <input type="hidden" id="UserRequiresApproval" name="UserRequiresApproval" value="@user.UserRequiresApproval" />

                        <label class="block-label" for="Title">Title</label>
                        <div class="textbox"><input type="text" class="required" name="Title" id="Title" value="@user.Title" /></div>

                        <label class="block-label" for="Forname">Forname(s)</label>
                        <div class="textbox"><input type="text" class="required" name="Forename" id="Forename" value="@user.Forename" /></div>

                        <label class="block-label" for="Surname">Surname</label>
                        <div class="textbox"><input type="text" class="required" name="Surname" id="Surname" value="@user.Surname" /></div>

                        <label class="block-label" for="UserName">Username</label>
                        <div class="textbox"><input type="text" class="required" id="UserName" name="UserName" value="@user.UserName" /></div>

                        <label class="block-label" for="file">Upload profile image</label>
                        <div class="textbox file"><input type="file" id="file" name="file" /></div>

                        <label class="block-label" for="JobTitle">Job title</label>
                        <div class="textbox"><input type="text" name="JobTitle" id="JobTitle" value="@user.JobTitle" /></div>

                        <label class="block-label" for="Telephone">Telephone</label>
                        <div class="textbox"><input type="text" name="Telephone" id="Telephone" value="@user.Telephone" /></div>

                        <label class="block-label" for="Mobile">Mobile</label>
                        <div class="textbox"><input type="text" name="Mobile" id="Mobile" value="@user.Mobile" /></div>

                        <label class="block-label" for="Email">Email address</label>
                        <div class="textbox"><input type="text" class="required" name="Email" id="Email" value="@user.Email" /></div>

                        @if (SettingsProvider.CurrentSiteSettings().TwoFactorAuthentication)
                        { 
                            <label class="block-label" for="CredentialId">Credential Id</label>  
                            <div class="textbox"><input type="text" class="required" id="CredentialId" name="CredentialId" value="@user.CredentialId" /></div>
                            <input type="hidden" class="required" name="Code" value="Security Code" />
                        }
                        else
                        {
                            <input type="hidden" class="required" name="CredentialId" value="@credentialId" />
                            <input type="hidden" class="required" name="Code" value="Security Code" />
                        }   

                        <label class="block-label" for="LinkedIn">LinkedIn</label>
                        <div class="textbox"><input type="text" name="LinkedIn" id="LinkedIn" value="@user.LinkedIn" /></div>

                        <label class="block-label" for="Twitter">Twitter</label>
                        <div class="textbox"><input type="text" name="Twitter" id="Twitter" value="@user.Twitter" /></div>

                        <label class="block-label" for="Facebook">Facebook</label>
                        <div class="textbox"><input type="text" name="Facebook" id="Facebook" value="@user.Facebook" /></div>

                        <label class="block-label" for="Bio">Bio</label>
                        <div class="textbox"><textarea id="Bio" name="Bio" rows="9">@user.Bio</textarea></div>

                        <div class="action">
                            <button>Save</button>
                        </div>
                        <button id="cancel">Cancel</button>
                    </div>
                </div>
            </div>
        </div>
    </form>

    <script src="@Url.Content("~/Scripts/jquery.skipstone-profile-save.js")" type="text/javascript"></script>
}
else
{
    throw new Exception("Invalid id specified.");
}

现在,我遇到了一个问题......

/Profile(显示当前用户的字段并且工作正常)

/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 作为参数可能是个问题。无论如何,我仍然遇到同样的问题......

4

2 回答 2

1

我想到了。这是因为在 Web.config

<requestLimits maxAllowedContentLength="1048576000" maxUrl="260" maxQueryString="25" />

它是 maxQueryString。

我已经删除了 maxUrl 和 maxQueryString,现在一切正常:)

于 2013-05-17T22:06:06.390 回答
0

刚出手,你应该有两个吗?在网址中?

我很确定你只能拥有一个?并用 & 分隔查询字符串参数

所以你应该使用这个形状

/Profile?id=Profile&id=E23CB58D-BDBC-4BE5-A27C-7E6518ED72B0

于 2013-05-17T09:54:54.873 回答