Asp net authorization doesnt work in chrome ie and opera


ASP.NET is a popular programming language used for building web applications. One common that developers may encounter is the authorization not working properly in certain browsers like Chrome, IE, and Opera. In this article, we will explore some possible solutions to this problem.

Understanding the Issue

Before we dive into the solutions, let's first understand why the ASP.NET authorization may not work in these browsers. The most common reason is that these browsers have stricter security settings compared to others. They may block certain cookies or scripts that are essential for the authorization process.

Solution 1: Settings

One way to solve this issue is by configuring the cookie settings in your ASP.NET application. By default, ASP.NET uses cookies to user authentication and authorization. However, some browsers may block these cookies, causing the authorization to fail.

To configure the cookie settings, you can add the following code to your ASP.NET application:


This code snippet sets the cookieless attribute to “UseCookies”, which ensures that cookies are used for authentication and authorization. This can help resolve the issue in some cases.

Solution 2: Use Cross-Browser Compatible Authorization Techniques

Another solution is to use cross-browser compatible authorization techniques. Instead of relying solely on cookies, you can implement other methods like token-based authentication or session management.

For example, you can use JSON Web (JWT) for authentication. JWTs are self- tokens that contain all the necessary information for authentication and authorization. They can be easily passed between the and server, making them compatible with all browsers.

Here's an example of how you can implement JWT authentication in ASP.NET:

    // Generate JWT token
    var tokenHandler = new JwtSecurityTokenHandler();
    var key = Encoding.ASCII.GetBytes("your-secret-key");
    var tokenDescriptor = new SecurityTokenDescriptor
        Subject = new (new []
            new Claim(ClaimTypes.Name, "John Doe"),
            new Claim(ClaimTypes.Role, "Admin")
        Expires = DateTime.UtcNow.AddDays(7),
        SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
    var token = tokenHandler.CreateToken(tokenDescriptor);
    var tokenString = tokenHandler.WriteToken(token);
    // Send token to the client
    // Validate token on the server
    var tokenValidationParameters = new TokenValidationParameters
        ValidateIssuerSigningKey = true,
        IssuerSigningKey = new SymmetricSecurityKey(key),
        ValidateIssuer = false,
        ValidateAudience = false
    var tokenHandler = new JwtSecurityTokenHandler();
    var claimsPrincipal = tokenHandler.ValidateToken(tokenString, tokenValidationParameters, out var validatedToken);

This example demonstrates how to generate a JWT token on the server and send it to the client. The client can then include the token in subsequent requests for authorization. On the server side, the token is validated to ensure its authenticity and integrity.


ASP.NET authorization not working in browsers like Chrome, IE, and Opera can be a frustrating issue for developers. However, by configuring cookie settings and using cross-browser compatible authorization techniques like JWT, you can overcome this problem. Remember to test your application thoroughly in browsers to ensure a seamless user experience.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents