ProfileService.cs
上传用户:szgaoree
上传日期:2009-01-05
资源大小:74k
文件大小:2k
- #if(NET20)
- /*
- * MS 05-12-20 initial version
- * MS 06-04-16 changed methods to static
- *
- *
- *
- *
- */
- using System;
- using System.Collections;
- using System.Configuration;
- using System.Web;
- using System.Web.Profile;
- namespace AjaxPro.Services
- {
- [AjaxNamespace("AjaxPro.Services.Profile")]
- public class ProfileService
- {
- [AjaxMethod]
- public static Hashtable GetProfile()
- {
- ProfileBase profile = HttpContext.Current.Profile;
- if (profile == null)
- {
- return null;
- }
- Hashtable ht = new Hashtable();
- foreach(SettingsProperty property in ProfileBase.Properties)
- {
- ht.Add(property.Name, profile[property.Name]);
- }
- return ht;
- }
- [AjaxMethod]
- public static IDictionary GetProfileProperties(Array properties)
- {
- ProfileBase profile = HttpContext.Current.Profile;
- if (profile == null)
- {
- return null;
- }
- Hashtable ht = new Hashtable();
- foreach(string name in properties)
- {
- ht.Add(name, profile[name]);
- }
- return ht;
- }
- [AjaxMethod]
- public static void SetProfile(Hashtable ht)
- {
- ProfileBase profile = HttpContext.Current.Profile;
- foreach (DictionaryEntry entry in ht)
- {
- profile[(string)entry.Key] = entry.Value;
- }
- }
- }
- }
- #endif