Specify the Path of the Profile Service in ScriptManager.
In ASP. net ajax client script, if Sys. services. profileService. if the set_path method is used to specify an address that provides the Profile Service, the default address is used.. net ajax Profile Service uses a specific class in the Assembly. Generally, you do not need to manually call the Sys. Services. ProfileService. set_path method. You only need to specify it in ScriptManager. As follows:
- <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Debug">
- <ProfileService Path="CustomProfileService.asmx" />
- </asp:ScriptManager>
Implement your own Web Service class
If you specify your Web Service class, you must implement your class. In fact, we need to implement three methods. In this regard, the Profile Service of ASP. net ajax uses the default Web Service Microsoft. Web. Profile. ProfileService, which is an excellent reference. Therefore, analyzing these methods here is very helpful for our custom work.
It may be worth noting that when we implement these methods, theoretically speaking, the parameter type does not need to be exactly the same as that in Microsoft. Web. Profile. ProfileService. ASP. net ajax can convert the obtained JSON string to the desired type based on the parameter type as much as possible. But in fact, it seems that the parameter selection for those methods in Microsoft. Web. Profile. ProfileService is already very reasonable. In addition, the client Profile Service code is not easy to modify. In fact, the client cannot be expanded. In the most extreme case, isn't it because we implement a ProfileService ourselves ?), In order to ensure that the returned JSON string can be correctly processed, the return values of these methods can remain unchanged.
GetAllPropertiesForCurrentUser Method
This method is used to obtain all Profile information of the current user. It does not have any input parameters. The returned JSON string format is as follows:
- {
- 'ZipCode' : ...,
- 'Address.City' : ...,
- 'Address.State' : ...
- }
It uses GroupName. ProfileName to represent the Profile Group. Each Profile in the Group needs to be listed separately, and "..." indicates the JSON string corresponding to the Profile value.
In Microsoft. Web. Profile. ProfileService, the code for this method is as follows:
- [WebMethod]
- public IDictionary<string, object> GetAllPropertiesForCurrentUser()
- {
- ProfileService.CheckProfileServicesEnabled();
- return ProfileService.GetProfile(HttpContext.Current, null);
- }
GetPropertiesForCurrentUser Method
This method is used to obtain the Profile information specified by the current user. Its input JSON string format is as follows:
['Zipcode', 'address. city', 'address. state']
It returns the same JSON string as GetAllPropertiesForCurrentUser, so we will not repeat it here. The above describes the use of ASP. net ajax Profile Service.
- WebRequestExecutor in ASP. NET
- IIS6 ASP. net isapi request processing process
- Backup in ASP. NET
- Introduction to ASP. NET ISAPI
- Iis isapi extension of ASP. NET