public static void Main()
    {
        TcpChannel myChannel = new TcpChannel(8085);

        ChannelServices.RegisterChannel(myChannel);

        MyServiceClass myService = new MyServiceClass();

        // After the channel is registered, register the object
        // with remoting infrastructure by calling Marshal method.
        ObjRef myObjRef = RemotingServices.Marshal(myService, "TcpService");

        // Get the information contributed by active channel.
        IChannelInfo      myChannelInfo = myObjRef.ChannelInfo;
        IChannelDataStore myIChannelData;

        foreach (object myChannelData in myChannelInfo.ChannelData)
        {
            if (myChannelData is IChannelDataStore)
            {
                myIChannelData = (IChannelDataStore)myChannelData;
                foreach (string myUri in myIChannelData.ChannelUris)
                {
                    Console.WriteLine("Channel Uris are -> " + myUri);
                }
                // Add custom data.
                string myKey = "Key1";
                myIChannelData[myKey] = "My Data";
                Console.WriteLine(myIChannelData[myKey].ToString());
            }
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        Object obj = Session["UserName"];
        if (obj != null) {
            userName = obj.ToString();
            Label1.Text = userName;

            service = MyServiceClass.GetMyServiceClassInstance();
            GetQuestionnairsTable();
        }
        else {
            Server.Transfer("Default.aspx");
        }
    }
    protected override void OnInit(EventArgs e)
    {
        if (!Page.IsPostBack) {
            base.OnInit(e);
            Object userNameObj = Session["UserName"];
            if (userNameObj != null) {
                userName = userNameObj.ToString();
            }
            else {
                Server.Transfer("Default.aspx");
            }
            Object qList = Session["questionList"];
            Object obj = Session["questionnairId"];
            Object sessionqIndex = Session["questionIndex"];

            service = MyServiceClass.GetMyServiceClassInstance();
            if (obj != null && qList == null) {
                int id = int.Parse(obj.ToString());
                questionList = service.GetQuestions("" + id, userName);
                Session["questionList"] = questionList;
                Session["questionIndex"] = qIndex;
            }
            else if (qList != null) {
                questionList = (List<KeyValuePair<string, string>>) qList;
                if (sessionqIndex != null) {
                    qIndex = (int) sessionqIndex;
                }
            }
            if (questionList.Count > 0) {
                Label1.Text = questionList[qIndex].Value;
                int oldAnswer = service.TjekQuestionAnswer(userName, questionList[qIndex].Key);
                if (oldAnswer != -1) {
                    RadioButtonList1.SelectedIndex = oldAnswer - 1;
                }
                if (qIndex == questionList.Count - 1) {
                    Button2.Text = "Afslut >>";
                }
                if (qIndex == 0) {
                    Button1.Text = "<< Tilbage";
                }
            }
        }
        else {
            questionList = (List<KeyValuePair<string, string>>) Session["questionList"];
            qIndex = (int) Session["questionIndex"];
            service = MyServiceClass.GetMyServiceClassInstance();
            userName = Session["UserName"].ToString();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     service = MyServiceClass.GetMyServiceClassInstance();
 }