Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Preventing same cookies twice
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Preventing same cookies twice
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01638282
Message ID:
01638282
Vues:
43
Hi everybody,

I'm trying to go to the root of the problem. We're creating an ASP.NET MVC application.

I see the following code
DateTime expirationDate = DateTime.Now.AddMinutes(lockTime);

            System.Web.HttpCookie timeoutCookie = new System.Web.HttpCookie(
                SysManagerConstants.AUTH_TIMEOUT_COOKIE_KEY,
                expirationDate.ToLongTimeString());

            timeoutCookie.Expires = expirationDate;

            timeoutCookie.Path = "/";

            filterContext.HttpContext.Response.Cookies.Add(timeoutCookie);
Under certain scenarios I'm getting an error (when I am debugging the code) that the filterContext can not be modified after it was being sent.

I am not sure how to prevent this situation, e.g. that code executing in some sort of a loop.

So, the idea is to prevent this situation of appending something when the context already sent.

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform