asp.net - Deny access to a persistent cookie -


if logs in on pc starbucks (for example) , accidentally check 'remember me' option thereby setting persistent cookie on pc, there way of denying cookie server without resorting changing cookie name in web.config?

i solved (a while actually) setting machinekey in web.config & changing when username/password changed:

 sub changemachinekey()     dim commandlineargs string() = system.environment.getcommandlineargs()     dim decryptionkey string = createmachinekey(64)     dim validationkey string = createmachinekey(128)     'httpcontext.current.response.write(decryptionkey + "<br />" + validationkey + "<hr />")     dim filename string = httpcontext.current.server.mappath("~/web.config")     dim xmlreader xmltextreader = new xmltextreader(filename)      dim xdoc xmldocument = new xmldocument()     xdoc.load(xmlreader)     xmlreader.close()      dim node system.xml.xmlnode = xdoc.selectsinglenode("//configuration/system.web/machinekey")     node.attributes.getnameditem("validationkey").value = validationkey     node.attributes.getnameditem("decryptionkey").value = decryptionkey     xdoc.save(filename) end sub  public shared function createmachinekey(byval numbytes integer) string     dim random byte() = new byte(numbytes / 2 - 1) {}     dim rng new rngcryptoserviceprovider()     rng.getbytes(random)     dim machinekey new system.text.stringbuilder(numbytes)     dim integer = 0     while < random.length         machinekey.append(string.format("{0:x2}", random(i)))         += 1     loop     return machinekey.tostring() end function 

this forces sign in again since there 1 admin account works me!


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -