Hello folks,
I got a .Net APP which has a login form that will authenticate the user to a domino APP(names.nsf?Login…)
thats ok and easy.
The problem ( i think its a problem as im a .net newbie) is how could i check if the user´s session(notessession) is still alive?
if not logged, it will ask for login, if logged it will proceed the tasks
like
if(user.session) keepGoing()
else goToLogin()
how do i approach that in .Net ?
any doubts or tips feel free to post!
T.I.A,
fferrandini
Subject: .net GET NOTESSESSION question
Here is my article about logging in to Domino from PHP: IBM - United States make it work in .NET would be very similar.
You login to Domino using db.nsf?Login and POST username and password. As result of the request you get a session cookie. You save that cookie internally and then can append it to your request to some protected page on Domino server to see if you get a login response or the actual page. If you get a login page, then the session has expired and you must login the user again (using saved username and password?).
Here is the PHP code:
$req=“username=john+doe&password=john123”;
$opts = array(
“http”=>array(
"method"=>"POST",
"content" => $req,
"header"=>"Accept-language: en\r\n" .
"User-Agent: Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.1)\r\n"
)
);
$context = stream_context_create($opts);
if (!($fp = fopen(“http://server.com/maildb.nsf?login”,
"r", false, $context))) {
die(“Could not open login URL”);
}
$meta = stream_get_meta_data($fp);
for ($j = 0; isset($meta[“wrapper_data”][$j]); $j++)
{
if (strstr(strtolower($meta[“wrapper_data”][$j]), ‘set-cookie’))
{
$cookie = substr($meta[“wrapper_data”][$j],12);
break;
}
}
fclose($fp);
$_SESSION[“DominoCookie”]=$cookie; //save cookie for later use
/Andrei
Sametime goes AJAX: Botstation - Sametime Widget Overview