I need to get user id from asp.net mvc 3 app in console app. Here is my code: (mvc)\[code\]public class MembershipRepository : IMembershipRepository{ public Guid GetUserId(string name) { var providerUserKey = Membership.GetUser(name).ProviderUserKey; // HttpException if (providerUserKey != null) return (Guid)providerUserKey; throw new NullReferenceException("user with this username does't exist"); }}\[/code\](console) code: \[code\]ninjectKernel.Bind<IMembershipRepository>().To<MembershipRepository>();var membershipRepository = ninjectKernel.Get<IMembershipRepository>();Guid userId = membershipRepository.GetUserId("admin");\[/code\]HttpException: Unable to connect to the Sql server database.Before the exception occures the window pops up: This program has compatibility problems (microsoft sql seqver 2008 and 2008 r2).
I have sql server 2012 installed.Besides, it's only a small chunk of code. Before I'm trying to get userId I use other repositories to add data to the database and it works: when I check the table contents it's full of new entries.How do I need to change the code? Mabby there is some other way to get userId in console app? Thanks!
I have sql server 2012 installed.Besides, it's only a small chunk of code. Before I'm trying to get userId I use other repositories to add data to the database and it works: when I check the table contents it's full of new entries.How do I need to change the code? Mabby there is some other way to get userId in console app? Thanks!