我不知道为什么我收到此错误消息.我在我的sql数据库中为它定义了一个主键.这是我的代码:
[HttpPost]
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
// Attempt to register the user
MembershipCreateStatus createStatus = MembershipService.CreateUser(model.UserName, model.Password, model.Email);
if (createStatus == MembershipCreateStatus.Success)
{
FormsService.SignIn(model.UserName, false /* createPersistentCookie */);
MembershipUser myObject = Membership.GetUser();
Guid UserID = (Guid)myObject.ProviderUserKey;
MyProfile profile = new MyProfile();
profile.Address = model.Address;
profile.City = model.City;
profile.Zip = model.Zip;
profile.State = model.State;
profile.UserId = UserID;
db.Profiles.Add(profile);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));
}
}
// If we got this far, something failed, redisplay …
Run Code Online (Sandbox Code Playgroud) 我已尝试以下方法重置我的列的标识种子:
DBCC CHECKIDENT ('dbo.Stuff', RESEED, 0)
Run Code Online (Sandbox Code Playgroud)
这在sql azure中不起作用,我想知道这样做的最佳方法是什么.删除并重新创建表?
在SignalR Hub类中,您可以呼叫Context.ConnectionId
用户.我希望将这些存储Dictionary<string, string>
在一起,以便将用户连接在一起.将其他用户的clientid返回给用户的客户端是否存在风险或安全漏洞?
我使用SQL Server 2012 Management Studio连接到我的SQL azure服务器,我无法编辑任何表格的模式或其中的数据.当我右键单击表格时,缺少选项.难道我做错了什么?
如果我想添加一个只能是两个值的列,例如,一个名为"Gender"的列,其中包含两个可能的"男性"或"女性"选项
我通过"AddObject(Object)"方法插入到数据库中,我想获取最后一个插入的id,这样我就可以插入另一个具有最后创建的id的表中.我该怎么做呢?这是最好的方法吗?还是有更好的方法?
@model IEnumerable<Framely2011.Models.Frames>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th></th>
<th>
PictureID
</th>
<th>
UserID
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
<td>
@item.PictureID
</td>
<td>
@item.UserID
</td>
<td>
Meta 1: @item.MetaTagsObj.Meta1 Meta 2: @item.MetaTagsObj.Meta2 Meta 3: @item.MetaTagsObj.Meta3
</td>
</tr>
}
</table>
Run Code Online (Sandbox Code Playgroud)
如果模型出现空白,我怎么才能让它打印出"没有框架",这样根本没有打印出任何html表,我认为一个简单的if …
我有以下代码:
var fd = new FormData();
var key = "events/" + (new Date).getTime() + '-';
fd.append('key', key);
fd.append('acl', Acl);
fd.append('Content-Type', "image/jpeg");
fd.append('AWSAccessKeyId', AWSAccessKeyId);
fd.append('policy', Policy);
fd.append('name', "Policy13492345");
fd.append('success_action_status', "201");
fd.append('signature', Signature);
fd.append("file", blob);
fd.append("filename", fileName + ".jpg");
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.addEventListener("load", uploadComplete, false);
xhr.addEventListener("error", uploadFailed, false);
xhr.addEventListener("abort", uploadCanceled, false);
xhr.open('POST', 'https://s3.amazonaws.com/' + Bucket + '/', true);
xhr.send(fd);
Run Code Online (Sandbox Code Playgroud)
当此请求通过时,我收到以下错误:
<Code>AccessDenied</Code><Message>Invalid according to Policy: Policy Condition failed: ["starts-with", "$Filename", ""]</Message>
我不知道我做错了什么,我生成我的blob是这样的:
function dataURItoBlob(dataURI) {
var binary = …
Run Code Online (Sandbox Code Playgroud)