asp.net - Login control won't login -
i've been using vs 2013 , created asp.net web forms application using template bootstrap. have login control of default behaviour using aspnet tables within sql. when run within ide have no problems in browser logging site (ie, chrome) manly using ie when running.
however, have deployed site local server testing , stops working in ie. happens goes through validation of user name/password fine, gets redirect user never logged in.
if browse server using chrome on pc work fine if same within ie won't work 95% of time have managed login occasionally. have asked other colleague's try, chrome doesn't work of them or ie. have tried on ipad chrome work safari won't!
so in file startup.auth.vb
partial public class startup
' more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?linkid=301883 public sub configureauth(app iappbuilder) 'configure db context, user manager , signin manager use single instance per request app.createperowincontext(addressof applicationdbcontext.create) app.createperowincontext(of applicationusermanager)(addressof applicationusermanager.create) app.createperowincontext(of applicationsigninmanager)(addressof applicationsigninmanager.create) ' enable application use cookie store information signed in user app.usecookieauthentication(new cookieauthenticationoptions() { .authenticationtype = defaultauthenticationtypes.applicationcookie, .provider = new cookieauthenticationprovider() { .onvalidateidentity = securitystampvalidator.onvalidateidentity(of applicationusermanager, applicationuser)( validateinterval:=timespan.fromminutes(10), regenerateidentity:=function(manager, user) user.generateuseridentityasync(manager))}, .loginpath = new pathstring("/account/login")}) ' use cookie temporarily store information user logging in third party login provider app.useexternalsignincookie(defaultauthenticationtypes.externalcookie) ' enables application temporarily store user information when verifying second factor in two-factor authentication process. app.usetwofactorsignincookie(defaultauthenticationtypes.twofactorcookie, timespan.fromminutes(5)) ' enables application remember second login verification factor such phone or email. ' once check option, second step of verification during login process remembered on device logged in from. ' similar rememberme option when log in. app.usetwofactorrememberbrowsercookie(defaultauthenticationtypes.twofactorrememberbrowsercookie) end sub end class
then on login button
protected sub login(sender object, e eventargs) if isvalid ' validate user password dim manager = context.getowincontext().getusermanager(of applicationusermanager)() dim signinmanager = context.getowincontext().getusermanager(of applicationsigninmanager)() ' doen't count login failures towards account lockout ' enable password failures trigger lockout, change shouldlockout := true dim result = signinmanager.passwordsignin(email.text, password.text, rememberme.checked, shouldlockout:=true) select case result case signinstatus.success identityhelper.redirecttoreturnurl(request.querystring("returnurl"), response) exit select case signinstatus.lockedout response.redirect("/account/lockout") exit select case signinstatus.requiresverification response.redirect(string.format("/account/twofactorauthenticationsignin?returnurl={0}&rememberme={1}", request.querystring("returnurl"), rememberme.checked), true) exit select case else failuretext.text = "invalid login attempt" errormessage.visible = true exit select end select end if end sub end class
Comments
Post a Comment