asp.net-mvc-5.2

ASP.NET MVC 5.1 C# OWIN facebook authentication or login ask for birthday, likes, public profile, phone number

[亡魂溺海] 提交于 2019-11-30 09:02:26
I have seen many posts for facebook authentication , either those are old or not working correctly as it should be. However finally I have made something in my project that works but not fully. Here is code where I ask for var facebookAuthenticationOptions = new FacebookAuthenticationOptions() { AppId = "...ID", AppSecret = "...AppSecret", AuthenticationType = "Facebook", SignInAsAuthenticationType = "ExternalCookie", //Provider = new FacebookAuthenticationProvider //{ // OnAuthenticated = async ctx => // { // if (ctx.User["birthday"] != null) // { // ctx.Identity.AddClaim(new Claim(ClaimTypes

Splitting foreach in a table

巧了我就是萌 提交于 2019-11-29 18:16:18
As of right now my table looks like this: But I want to split the foreach to have it look something like this Is possible to do this? And this is the foreach: @foreach (var date in ViewBag.MissingDays) { var isoDate = date.ToString("yy-MM-dd"); <tr> <td> <a href="javascript:SetDate('@isoDate');">@isoDate</a> </td> </tr> } You can use the following code to generate rows containing 9 columns @{var counter = 1; } <tr> @foreach (var date in ViewBag.MissingDays) { var isoDate = date.ToString("yy-MM-dd"); <td><a href="javascript:SetDate('@isoDate');">@isoDate</a></td> if (counter % 9 == 0) { @:</tr>

ASP.NET MVC 5.1 C# OWIN facebook authentication or login ask for birthday, likes, public profile, phone number

和自甴很熟 提交于 2019-11-29 12:50:45
问题 I have seen many posts for facebook authentication , either those are old or not working correctly as it should be. However finally I have made something in my project that works but not fully. Here is code where I ask for var facebookAuthenticationOptions = new FacebookAuthenticationOptions() { AppId = "...ID", AppSecret = "...AppSecret", AuthenticationType = "Facebook", SignInAsAuthenticationType = "ExternalCookie", //Provider = new FacebookAuthenticationProvider //{ // OnAuthenticated =

Asp.net Identity : User.Identity.GetUserId() is always null and User.Identity.IsAuthenticated is alway false

二次信任 提交于 2019-11-29 03:39:18
See my code below: var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout: false); switch (result) { case SignInStatus.Success: string UserId = User.Identity.GetUserId(); return RedirectToAction("ClientDetails","Home"); case SignInStatus.LockedOut: return View("Lockout"); case SignInStatus.RequiresVerification: return RedirectToAction("SendCode", "Account", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }); case SignInStatus.Failure: default: ModelState.AddModelError("", "Invalid login attempt."); return View(model); }

Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default

送分小仙女□ 提交于 2019-11-28 18:04:50
I am trying to target .NET 4.6 and also take advantage of the latest C# version by changing the C# language version to 6. However during compilation I got this error: Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default If I update the /langversion:6 in Web.Config setting to 5 it works, <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"> But how do

Splitting foreach in a table

无人久伴 提交于 2019-11-28 14:04:27
问题 As of right now my table looks like this: But I want to split the foreach to have it look something like this Is possible to do this? And this is the foreach: @foreach (var date in ViewBag.MissingDays) { var isoDate = date.ToString("yy-MM-dd"); <tr> <td> <a href="javascript:SetDate('@isoDate');">@isoDate</a> </td> </tr> } 回答1: You can use the following code to generate rows containing 9 columns @{var counter = 1; } <tr> @foreach (var date in ViewBag.MissingDays) { var isoDate = date.ToString(

ASP.NET MVC 5 : Endless redirect to the login page using the site template

时光总嘲笑我的痴心妄想 提交于 2019-11-28 13:34:09
I just started using ASP.NET MVC 5 (I already used the previous versions quite a lot) and I have a very weird issue: I created a new website using the Visual Studio 2013 (fully updated) ASP.NET template. For the template options I selected the MVC template, "Individual User Accounts" authentication type, no cloud hosting, and no other components than the core MVC library. After I validate the options, I update all the NuGet packages. And after that I press F5 (without opening or modifying any of the new project files). The browser opens only to show an error page, because of an endless

Asp.net Identity : User.Identity.GetUserId() is always null and User.Identity.IsAuthenticated is alway false

守給你的承諾、 提交于 2019-11-27 17:53:32
问题 See my code below: var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout: false); switch (result) { case SignInStatus.Success: string UserId = User.Identity.GetUserId(); return RedirectToAction("ClientDetails","Home"); case SignInStatus.LockedOut: return View("Lockout"); case SignInStatus.RequiresVerification: return RedirectToAction("SendCode", "Account", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }); case

Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default

坚强是说给别人听的谎言 提交于 2019-11-27 11:01:37
问题 I am trying to target .NET 4.6 and also take advantage of the latest C# version by changing the C# language version to 6. However during compilation I got this error: Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default If I update the /langversion:6 in Web.Config setting to 5 it works, <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken

ASP.NET MVC 5 : Endless redirect to the login page using the site template

柔情痞子 提交于 2019-11-27 07:45:53
问题 I just started using ASP.NET MVC 5 (I already used the previous versions quite a lot) and I have a very weird issue: I created a new website using the Visual Studio 2013 (fully updated) ASP.NET template. For the template options I selected the MVC template, "Individual User Accounts" authentication type, no cloud hosting, and no other components than the core MVC library. After I validate the options, I update all the NuGet packages. And after that I press F5 (without opening or modifying any