silverlight+wcf 获得web参数

时间:2021-02-12 17:17:29

可以由wcf直接得到参数 ,具体代码如下:

using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
using BS.EAP.DBAccess;
using System.Data;
using System.Xml;
using System.Collections;
using BS.EAP.Authentication;//引用到的类型CurrentUserInfo
using BS.EAP.Account.Model; //引用到的类型SYS_APPLICATIONInfo

public class DBService : System.Web.UI.Page //继承类 Session
    {

[OperationContract]
        public void DoWork()
        {
            // 在此处添加操作实现
            return;
        }

//定义全局变量接收参数
        public static string strUserid;
        public static string strAppid;
        public static string strChartName;

//

/// <summary>
        /// 当前用户信息 CurrentUserInfo 是类: CurrentUserInfo.cs
        /// </summary>
        public CurrentUserInfo CurrentUserInfo
        {
            get
            {
                if (Session["CurrentUserInfo"] != null)
                {
                    return (CurrentUserInfo)Session["CurrentUserInfo"];
                }
                return null;
            }
        }

/// <summary>
        /// 当前业务类别 SYS_APPLICATIONInfo 是类:SYS_APPLICATIONInfo.cs
        /// </summary>
        public SYS_APPLICATIONInfo CurrentApplication
        {
            get
            {
                if (Session["CurrentApplication"] != null)
                {
                    return (SYS_APPLICATIONInfo)Session["CurrentApplication"];
                }
                return null;
            }
            set
            {
                Session["CurrentApplication"] = value;
            }
        }

strUserid= CurrentUserInfo.CurrUserInfo.USERID.ToString();
 strAppid= this.CurrentApplication.APPID.ToString();

//其他的操作

}