Tuesday, December 31, 2013

Owin Pipeline with respect to IIS Integrated Pipeline mode Issues

When working Owin authentication you must face following problems.

  • Check if your IIS application pool is in Integrated mode. Note: Running of an OWIN middleware is supported only on IIS Integrated pipeline. Classic pool is not supported. 
  • Check if you have Microsoft.Owin.Host.SystemWeb Nuget package installed. This package is required for the OWIN startup class detection.
  • If your Startup class is still not detected in IIS, try it again by clearing the ASP.net temporary files. 
  •  Sometimes Owin works well with VS IISexpress .
  • <

    appSettings>

    <


    add key="owin:AppStartup" value="[AssemblyNamespace].Startup,[AssemblyName]" />
    </

    appSettings>
     

    Tuesday, December 24, 2013

    Modified ASP.NET 4.5 CPU Throttling percentCpuLimit


    http://blogs.msdn.com/b/webdev/archive/2013/11/26/modified-asp-net-4-5-cpu-throttling.aspx

    <configuration>
        <system.web>
            <applicationPool percentCpuLimit=”90percentCpuLimitMinActiveRequestPerCpu=”100>
        </system.web>
    </configuration>

    The default throttling limit was also lowered from 99% to 90% in order to detect high pressure and avoid negative scaling earlier.

    Just Asp.net Identity Core


    Before You dive further please go through these blogpost for more clarity and brevity.






    1. No Entity Framework.
    2. No Asp.net database tables
    3. Use existing Database user table for authentication.
    Have extended and used following Interface and class
    1. IUser
    2. IUserStore
    3. UserManager

    In order to refer our own table we have extended the method FindSync of UserManager.


    public class CustomUserManager:UserManager<ApplicationUser>

    {


    public CustomUserManager() : base(new CustomUserSore<ApplicationUser>())

    {


    //We can retrieve Old System Hash Password and can encypt or decrypt old password using custom approach.


    this.PasswordHasher = new OldSystemPasswordHasher();

    }




    public override System.Threading.Tasks.Task<ApplicationUser> FindAsync(string userName, string password)

    {


    Task<ApplicationUser> taskInvoke = Task<ApplicationUser>.Factory.StartNew(() =>

    {


    //First Verify Password...


    PasswordVerificationResult result = this.PasswordHasher.VerifyHashedPassword(userName, password);


    if (result == PasswordVerificationResult.SuccessRehashNeeded)

    {


    //Return User Profile Object...


    //So this data object will come from DB via Nhiberanate


    ApplicationUser applicationUser = new ApplicationUser();

    applicationUser.UserName =
    "san";


    return applicationUser;

    }


    return null;

    });


    return taskInvoke;

    }

    }

    For Source code
    http://code.msdn.microsoft.com/Simple-Aspnet-Identiy-Core-7475a961


     

    Tuesday, December 3, 2013

    Javascript Identity Operator vs Equality Operator

     

    Equality and inequality tests

    ==, !=
    It checks and compare values of the variable.
     

    Example

    var firstVal = 5;//Number

    var secondVal = "5";//String

    if (firstVal == secondVal) {

    console.log("They are the equal");

    } else {

    console.log("They are NOT the equal");

    }

    Output:They are the equal
     ONlY Values are compared.

     

    Identity and nonidentity tests

    ===, !== It checks and compare values and types of the variable.

    Example

    var firstVal = 5; //Number

    var secondVal = "5"; //String

    if (firstVal === secondVal) {

    console.log("They are the same");

    } else {

    console.log("They are NOT the same");

    }

    Output : They are  NOT the same.

    Values and Types are compared.