I use PHP to do server-side, C # WinForm do the client. When a user logs in successfully, a B interface is displayed. When a user in the B interface to operate, how the server to determine that a user has logged in, if not logged in will prompt him without permission.
Reply to discussion (solution)
WinForm do not understand, PHP with the session can be.
With an intermediate variable can be, variable assignment is null, when a login success variable is assigned a value, the operation to determine the variable has no value on it!
After PHP login, session,?session deposit into the???
Whether it's WinForm or PHP? The control.
If the memcache, then the session can also be deposited into the memcache. Even if WinForm gets the session value of PHP, it can also be taken directly into the memcache value.
What's the big fan? Pinch
Can use CAS unified authentication
http://www.ibm.com/developerworks/cn/webservices/ws-casestudy/part4/
Does using session not solve?
Give a reference, huh. http://blog.csdn.net/lcawen88/article/details/8534978
I also use C # to do the client, this is very simple oh, the details I do not say, the general method:
First, after the client logs in, using HttpWebRequest to send an HTTP request, assuming that the page is login.php , you'll write a
code that stores the POST data in SESSION (like $_session["username"] = $_post["..."), and C # sends an HTTP request to this page to write the user's login information to the session. Then another management page is manager.php, this page will have a
Judge $_session["username"] code, and with Echo $_session["username"] method to output it, so C # Login manager.php time can get $_session["username"], it and the user name matching, exists and correctly entered the management interface, otherwise pop-up warning
C # with HttpWebRequest, The following code can get the value of the server PHP page on the client
HttpWebRequest myrequest = (HttpWebRequest) webrequest.create ("http://localhost:81/console_revised/" + page); data = Encoding. GetBytes (postdata); Myrequest.method = "POST"; Myrequest.contenttype = "application/x-www-form-urlencoded"; Myrequest.contentlength = data. Length; Stream newstream = Myrequest.getrequeststream (); Newstream.write (data, 0, data. Length); Newstream.close (); HttpWebResponse myresponse = (HttpWebResponse) myrequest.getresponse (); StreamReader reader = new StreamReader (Myresponse.getresponsestream (), encoding); String content = Reader. ReadToEnd (); Reader. Close (); Myresponse.close ();