using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;
namespace NewCitiZenBasic.TestViews
{
public partial class TT : UserControl
{
public TT()
{
InitializeComponent();
}
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
Making("memberNumber", "kojaedoo");
}
private void Making(string key, string value)
{
//날짜입력설정
//DateTime expiration = DateTime.Now.AddYears(100); //현재 날자에 100년을 추가한 날자
//string cookie = string.Format("{0}={1};expires={2}", key, value, expiration.ToString("R"));
string cookie = string.Format("{0}={1};", key, value );
HtmlPage.Document.SetProperty("Cookie", cookie);
}
private string GetCookie(string key)
{
string result = string.Empty;
string[] cookies = HtmlPage.Document.Cookies.Split(';');
foreach (string cookie in cookies)
{
string cookieStr = cookie.Trim(); //문자열 앞뒤로 공백 없애기
if (cookieStr.StartsWith(key + "=", StringComparison.OrdinalIgnoreCase)) //Key= 과 같은
{ //문자가 있을시 true 반환
string[] CrackedCookie = cookieStr.Split('=');
if (CrackedCookie[0] == key) {
result = CrackedCookie[1];
}
}
}
return result;
}
private void btng_Click(object sender, System.Windows.RoutedEventArgs e)
{
// TODO: Add event handler implementation here.\
MessageBox.Show(GetCookie("memberNumber"));
}
}
}
'WPF' 카테고리의 다른 글
ObservableCollection<(Of <(T>)>) Class (0) | 2010.01.02 |
---|---|
INotifyPropertyChanged (0) | 2010.01.02 |
Using Value Converters (0) | 2010.01.02 |
DataGrid 템플릿 (0) | 2010.01.02 |
간단한 data grid 사용법 (0) | 2010.01.02 |
웹 페이지에 Silverlight 추가 (0) | 2009.12.15 |
간단하게 세션처럼 사용하기?! (0) | 2009.12.15 |
WCF 웹서비스를 이용한 데이터 바인딩 (0) | 2009.12.15 |
ResizeGrip - Resizing (Mostly Custom) Windows (0) | 2009.12.15 |
SplashScreen 만들기 (0) | 2009.12.15 |