📄 profileservice.asmx
字号:
<%@ WebService Language="C#" Class="ProfileService" %>
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class ProfileService : System.Web.Services.WebService
{
/// <summary>
/// 获取用户的全部Profile
/// </summary>
/// <returns></returns>
[WebMethod]
public IDictionary<string, object> GetAllPropertiesForCurrentUser()
{
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("Age", 27);
dic.Add("Salary", 100);
Article article = new Article();
article.Title = "Article Title From Server";
article.PublishTime = DateTime.Now;
dic.Add("Article", article);
return dic;
}
/// <summary>
/// 获取用户的指定的Profile
/// </summary>
/// <param name="properties">属性名称数组</param>
/// <returns></returns>
[WebMethod]
public IDictionary<string, object> GetPropertiesForCurrentUser(string[] properties)
{
//Place code here.
return null;
}
/// <summary>
/// 保存用户的Profile
/// </summary>
/// <param name="values">用户的Profile的字典数据</param>
/// <returns></returns>
[WebMethod]
public int SetPropertiesForCurrentUser(IDictionary<string, object> values)
{
//Place code here.
return values.Count;
}
}
/// <summary>
/// Article实体类
/// </summary>
/// <remarks>
/// 示例而已,实际项目中要继承自System.Web.Profile.ProfileBase
/// </remarks>
public class Article
{
private string _title;
/// <summary>
/// 文章标题
/// </summary>
public string Title
{
get { return _title; }
set { _title = value; }
}
private DateTime _publishTime;
/// <summary>
/// 文章发布日期
/// </summary>
public DateTime PublishTime
{
get { return _publishTime; }
set { _publishTime = value; }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -