How to save log-in state in Windows Phone 8? -


i'm trying build app wp8 login page. want save user login state end-user not have retype his/her credentials, app html page embedded in webbrowser control. can me how save login state ?

first of if website trying log in not yours ask cannot done.

now assuming using webbrowser in xaml code , website log in yours lets have login successfull method:

there have call code:

window.external.notify("loginsuccess");

then webbrowser should this:

<phone:webbrowser horizontalalignment="stretch" name="webbrowsercontrol" verticalalignment="stretch" isscriptenabled="true" scriptnotify="javascriptnotify"/>

and method gets called in .cs file should store success value isolated storage checked every time open login page:

void javascriptnotify(object sender, notifyeventargs notifyargs) {     // check if value correct:     if (notifyargs.value.equals("loginsuccess"))     {         // save state isolated storage         var settings = isolatedstoragesettings.applicationsettings;         settings.add("loginstatus ", "success");     } } 

finally should override constructor method of login page following:

public loginpage() { var loginstatus = settings["loginstatus "].tostring(); if (loginstatus.equals(success)) { navigationservice.navigate(new uri("/pageafterloginpage.xaml, urikind.relative)); } }

and complete override onnavigatedto method of pageafterloginpage.xaml , add following code:

navigationservice.removebackentry();

last part remove login page stack when user clicks button wont navigated screen again.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -