profileservice.cs
来自「AJAX开发工具包」· CS 代码 · 共 64 行
CS
64 行
#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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?