मैं अपने आवेदन में प्रमाणीकरण (ओविन मिडलवेयर) के लिए एएसपीनेट पहचान 2.0 का उपयोग कर रहा हूं। सत्र अपहरण: जब मैं लॉगिन करता हूं पहचान पहचान AspNet.AplicationCookie.then, मैंने AspNet.AplicationCookie मान की प्रतिलिपि बनाई। तब मैंने एप्लिकेशन से लॉग आउट किया। लॉगआउट के बाद, मैं मैन्युअल रूप से कुकी बना रहा हूं (AspNet.AplicationCookie) और रीफ्रेश करें इसे रीडायरेक्ट करता है मुझे होम पेजविशेषाधिकार वृद्धि और सत्र में अपहरण एमवीसी 5
विशेषाधिकार वृद्धि: एक ही समय मैं के रूप में एक उपयोगकर्ता ऐ की नकल की (AspNet.ApplicationCookie) अपने कुकी में लॉग इन पर और मैं out.After लॉग इन मैं एक उपयोगकर्ता बीआई संपादन कर रहा हूँ उपयोगकर्ता B कुकी रूप में लॉग इन और चिपकाया उपयोगकर्ता A कुकी और इसे सेव किया। जब मैंने ब्राउजर को रीफ्रेश किया तो मैं यूजरए एक्सेस और प्रमाणीकरण प्राप्त कर सकता हूं।
मैं सभी सत्र साफ़ कर रहा हूं और सभी कुकीज़ को हटा रहा हूं जब मैंने लॉग आउट किया। Asp.Net पहचान (ओविन) भी नई AspNet उत्पन्न करता है। एप्लिकेशन हर बार कुकीज बनाता है। लेकिन फिर भी यह पुरानी कुकीज़ स्वीकार करता है और मुझे पहुंच प्रदान करता है मुझे नहीं पता क्यों? क्या कोई मुझे लॉग आउट करने के बाद पुराने AspNet.AplicationCookie को अमान्य कैसे कर सकता है। यह Startup.Auth.cs में मेरी कोड है
public void ConfigureAuth(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}
// यह लॉगआउट कोड है
public ActionResult LogOff ()
{
//Delete all cookies while user log out
string[] myCookies = Request.Cookies.AllKeys;
foreach (var cookies in myCookies)
{
Response.Cookies[ cookies ].Expires = DateTime.Now.AddDays(-1);
}
Request.GetOwinContext().Authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie);
// AuthenticationManager.SignOut();
Session.Clear();
Session.RemoveAll();
Session.Abandon();
return RedirectToAction("LoginPage", "Account");
}
// यह अपना लॉगिन नियंत्रक कोड है
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (ModelState.IsValid)
{
var user = await UserManager.FindAsync(model.UserName, model.Password);
if (user != null)
{
await SignInAsync(user, model.RememberMe);
return RedirectToLocal(returnUrl);
}
else
{
ModelState.AddModelError("", "Invalid username or password.");
}
}
// If we got this far, something failed, redisplay form
return View(model);
}