草庐IT

non-identity

全部标签

c# - 具有 HttpContext.Current.User.Identity.IsAuthenticated 的 Webmethods 在 Azure 上不活动后停止工作

我正在使用使用Ajax(json)/Webmethod函数的页面测试Azure服务器。其中一些函数在运行代码之前会检查HttpContext.Current.User.Identity.IsAuthenticated。不幸的是,如果用户已登录并且页面没有向服务器发出完整的回发请求,则只有那些检查HttpContext.Current.User.Identity.IsAuthenticated的webmethods函数会在一对夫妇之后完全停止运行分钟没有给出任何错误。他们甚至不运行else代码块(见下文)。我已经在本地服务器上测试了这些页面,一切正常,即使在长时间不活动之后也是如此。这是

c# - 带有自定义表的 Identity 2.0

我是ASP.NET身份的新手,我仍在努力了解它是如何工作的。不幸的是,我发现我试过的许多教程都是针对Identity1.0的,而我正在尝试使用Identity2.0。我面临的最大问题是我认为很简单,但事实证明并非如此。我想要做的是将现有数据库与现有用户表一起使用。目前我似乎能做的就是让Identity创建它自己的表来存储用户数据。我不想使用EntityFramework,但我很难将EntityFramework与Identity2.0分开。虽然我的情况是使用SQLServer,但我想我会尝试通过以下链接为MySQL实现自定义提供程序:http://www.asp.net/identit

c# - 如何修复 : The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical?

我正在对SQLServer2012数据库使用EntityFramework4.3.1,并且我正在使用POCO方法。我收到以下错误,我想知道是否有人可以解释如何修复它:模型验证异常Oneormorevalidationerrorsweredetectedduringmodelgeneration:\tSystem.Data.Entity.Edm.EdmAssociationConstraint::ThenumberofpropertiesintheDependentandPrincipalRolesinarelationshipconstraintmustbeidentical.没有可用

c# - 使用 MVC 5 和 Asp.net Identity 的电子邮件确认

我一直在搜索,但没有找到任何关于如何使用新的ASP.net身份通过MVC5实现电子邮件确认的文档。似乎没有关于这个主题的任何文档(我能找到)。有人解决了吗?我很惊讶默认MVC5项目中没有默认包含它。非常感谢任何指导。谢谢 最佳答案 我写了一个step-by-steparticleonhowtoaddemailconfirmationwhenusingASP.NETIdentity.你可以getthesourcecodehere在项目文件夹AspNetIdentity\AspNetIdentityRefApp中。我还创建了一个封装AS

c# - HttpContext.Current.User.Identity.Name 如何知道存在哪些用户名?

这不一定是个问题,我只是好奇它是如何工作的。我有一个方法:publicstaticboolUserIsAuthenticated(){boolisAuthed=false;try{if(HttpContext.Current.User.Identity.Name!=null){if(HttpContext.Current.User.Identity.Name.Length!=0){FormsIdentityid=(FormsIdentity)HttpContext.Current.User.Identity;FormsAuthenticationTicketticket=id.Tick

C# 错误 : "An object reference is required for the non-static field, method, or property"

我有两个类,一个用于定义算法参数,另一个用于实现算法:1类(算法参数):usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceVM_Placement{publicstaticclassAlgorithmParameters{publicstaticintpop_size=100;publicstaticdoublecrossover_rate=0.7;publicstaticdoublemutation_rate=0.001;publicstaticintchrom

c# - 跨子域的 ASP.NET Identity Cookie

对于表单例份验证,我在web.config中使用了它(注意域属性):如何为Mvc5中的新ASP.NETIdentityFramework配置跨子域的单点登录?更多信息:我正在创建一个Multi-Tenancy应用程序。每个客户端都在一个子域上:client1.myapp.comclient2.myapp.com我希望用户能够登录到client1.myapp.com然后转到client2.myapp.com并仍然登录。这是使用表单例份验证很容易。我正在尝试弄清楚如何使用新的身份框架来做到这一点。编辑这是最终为我工作的代码:app.UseCookieAuthentication(newCo

c# - Entity Framework 错误 : Cannot insert explicit value for identity column in table

我在EF上遇到这个错误。Cannotinsertexplicitvalueforidentitycolumnintable'GroupMembers_New'whenIDENTITY_INSERTissettoOFF.Db上的列是标识增量,在EF设计文件上,StoreGeneratedPattern也是标识。似乎每次我尝试保存时EF都试图插入0。一些建议说ID保留在表上或删除表并重新运行脚本。有什么想法吗?这是一些代码:GroupMembergroupMember=newGroupMember();groupMember.GroupId=group.Id;groupMember.Use

c# - 模拟新的 Microsoft Entity Framework Identity UserManager 和 RoleManager

有没有人为UserManager和RoleManager想出一个成功的模拟解决方案?我整天都在用头撞墙。我想要做的就是模拟对象以使用内存集合而不是访问EntityFramework数据存储。我搜索了互联网并尝试了几种不同的使用最小起订量的方法。我的印象是新东西更容易测试。我错过了什么吗? 最佳答案 或者,您可以模拟IUserStoreUserManager的界面接受作为参数。varuserStore=newMock>();varuserManager=newUserManager(userStore.Object);正如@JoeBr

c# - MVC : The parameters dictionary contains a null entry for parameter 'k' of non-nullable type 'System.Int32'

我是MVC的新手。在我的应用程序中,我正在从Mydatabase中检索数据。但是当我运行我的应用程序时,它会显示这样的错误这是我的网址http://localhost:7317/Employee/DetailsData/4ExceptionDetails:System.ArgumentException:Theparametersdictionarycontainsanullentryforparameter'k'ofnon-nullabletype'System.Int32'formethod'System.Web.Mvc.ActionResultDetailsData(Int32)