In the last blog post, we discussed the client's use of Web services. In this article we will review how to use the session state of the Web service.
This is a continuation of the previous article. So please review the previous article quickly so
This article provides a detailed analysis of session-based user logon permissions. For more information, see the following:
The code is as follows:
User name:
Password:
Session_start ();$ _ SESSION ["user"
For pages that require authentication, it is best to use Apache server Authentication.However, the Apache server verifies that the interface is not friendly. And it's not all the casecan use Apache server authentication, such as PHP under CGI mode
When you want to access the session status value in the httphandler (ashx file), you need to explicitly implement an InterfaceIreadonlysessionstate, for example: @ Webhandler Language = " C # " Class = " Downloadhandler " %>
1. Mark the WCF Service to enable the session Mode
[Servicecontract (sessionmode = sessionmode. Required)]
2. Add the aspnetsession compatibility tag to the service class
[System. servicemodel. Activation. aspnetcompatibilityrequirements
[Network reprint] Note:You must inherit the system. Web. sessionstate. irequiressessionstate interface to read and write sessions!
System. Web. sessionstate Interfaces
Ireadonlysessionstate specifies the target HTTP ProcessingProgramYou only
This article provides a detailed analysis of the implementation code that saves user login information by using session and cookie in php at the same time, for more information, see session and cookie to save user logon information.
1. database
When writing the project, suddenly think if the common sense of the card, do not first enter the login interface and direct access to the Web content, can it? As a result, the whole can go directly to the admin page and get full administrative
For pages that require authentication, it is best to apply apache server authentication. However, the interface for apache server verification is not friendly enough. In addition, not all situations can be verified by the apache server. for example,
This article provides a detailed analysis of session-based user logon permissions. For more information, see the following:
The code is as follows:
User name:
Password:
Session_start ();$ _ SESSION ["user"
In ASP. NET 2.0, server variables such as session and application can be used in webmethod.
I. Session
[Webmethod (enablesession
=
True
)]
Public
String
Hello ()
{Return "Hello," +Session ["User"];}
[Webmethod
Note the following three points:
1. Add using system. Web. sessionstate to the namespace;
2. The interface name should be added to the irequiressessionstate or ireadonlysessionstate;
3. Both session and querystring must be obtained through
Today I wrote a SectionProgramUse session in httphandler. As a result, the session object reports an error, "the object has not been referenced to the instance of the object". I am depressed for a long time and do not know what is going on.
As a
Add the following at the beginning of the first pageCode:Session_start ();$ Current_id = session_id ();Var_dump ($ current_id); // print the session information of $ current_id$ _ Session ['username'] = 'good ';// Set the username value of the
B. php codeCopy codeThe Code is as follows:// Access only through postIf ($ _ SERVER ['request _ method'] = 'get '){Header ('HTTP/1.1 404 Not Found '); die ('parent, the page does Not exist ');}Session_start ();$ Fs1 = $ _ POST ['a'];$ Fs2 = $ _
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.