vb vbFromUnicode c# 으로 변경 샘플

VB Source

한글을 2byte 로 계산하기 위해 아래로 같은 변경하여 위치의 byte들을 가져온다.

Public Function Data_Cut(sDat, Start_len, last_len) As String Dim Tmp_Chk As String

Tmp_Chk = StrConv(MidB(StrConv(sDat, vbFromUnicode), Start_len, last_len), vbUnicode) Data_Cut = Tmp_Chk End Function

To C# Source

C# 으로 변경하면 다음과 같이 사용할수 있다. ks_c_5601-1987 Encode 로 변경하면 한글은 2바이트로 […]

visual studio 2013 설치시 오류

지정된 트러스트 공급자가, 주제에 대해 지정된 형식을 지원하지 않거나 알 수 없습니다.

ISO 파일 풀지 말고 CD 나 USB 로 구워 설치 하면 됩니다.

iso 파일을 usb 로 저장

다운로드 isotousb_setup


Email Address Validation Using Regular Expression

public static class TestEmail { /// <summary> /// Regular expression, which is used to validate an E-Mail address. /// </summary> public const string MatchEmailPattern = @"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@" + @"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]? [0-9]{1,2}|25[0-5]|2[0-4][0-9])\." + @"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]? [0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|" + @"([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$"; /// <summary> /// Checks whether the given Email-Parameter is a valid E-Mail address. /// </summary> /// <param name="email">Parameter-string that contains an E-Mail address.</param>
/// <returns>True, when Parameter-string is not null and
/// contains a valid E-Mail address;
/// otherwise false.</returns>
public static bool IsEmail(string email)
if (email != null) return Regex.IsMatch(email, MatchEmailPattern);
else return false;

참조 : http://www.codeproject.com/Articles/22777/Email-Address-Validation-Using-Regular-Expression

셈틀누리 :: maxQueryStringLength 값을 초과합니다.

maxQueryStringLength="204800" maxRequestLength="409600"

via 셈틀누리 :: maxQueryStringLength 값을 초과합니다..

win server event log 이벤트 로그 확인

이벤트 로그 확인으로 DotNet 프로그램의 상태를 알 수 있다.

C# Registry 메서드

소스 public static void RegistrySet() { // // This code example produces output similar to the following: // //NoSuchName: Return this default if NoSuchName does not exist. //(Default): 5280 //TestLong: 12345678901234 //TestArray(0): One //TestArray(1): Two //TestArray(2): Three //TestExpand: My path: %path% //TestExpand2: My path: D:\Program Files\Microsoft.NET\… // //Use the registry editor to examine the key. //Press the Enter key to delete the key

// The name of the key must include a valid root.
const string userRoot = "HKEY_CURRENT_USER";
const string subkey = "RegistrySetValueExample";
const string keyName = userRoot + "\\" + subkey;

// An int value can be stored without specifying the
// registry data type, but long values will be stored
// as strings unless you specify the type. Note that
// the int is stored in the default name/value
// pair.
Registry.SetValue(keyName, "", 5280);
Registry.SetValue(keyName, "TestLong", 12345678901234,

// Strings with expandable environment variables are
// stored as ordinary strings unless you specify the
// data type.
Registry.SetValue(keyName, "TestExpand", "My path: %path%");
Registry.SetValue(keyName, "TestExpand2", "My path: %path%",

// Arrays of strings are stored automatically as
// MultiString. Similarly, arrays of Byte are stored
// automatically as Binary.
string[] strings = { "One", "Two", "Three" };
Registry.SetValue(keyName, "TestArray", strings);

// Your default value is returned if the name/value pair
// does not exist.
string noSuch = (string)Registry.GetValue(keyName,
"Return this default if NoSuchName does not exist.");
Console.WriteLine("\r\nNoSuchName: {0}", noSuch);

// Retrieve the int and long values, specifying
// numeric default values in case the name/value pairs
// do not exist. The int value is retrieved from the
// default (nameless) name/value pair for the key.
int tInteger = (int)Registry.GetValue(keyName, "", -1);
Console.WriteLine("(Default): {0}", tInteger);
long tLong = (long)Registry.GetValue(keyName, "TestLong",
Console.WriteLine("TestLong: {0}", tLong);

// When retrieving a MultiString value, you can specify
// an array for the default return value.
string[] tArray = (string[])Registry.GetValue(keyName,
new string[] { "Default if TestArray does not exist." });
for (int i = 0; i < tArray.Length; i++)
Console.WriteLine("TestArray({0}): {1}", i, tArray[i]);

// A string with embedded environment variables is not
// expanded if it was stored as an ordinary string.
string tExpand = (string)Registry.GetValue(keyName,
"Default if TestExpand does not exist.");
Console.WriteLine("TestExpand: {0}", tExpand);

// A string stored as ExpandString is expanded.
string tExpand2 = (string)Registry.GetValue(keyName,
"Default if TestExpand2 does not exist.");
Console.WriteLine("TestExpand2: {0}…",
tExpand2.Substring(0, 40));

Console.WriteLine("\r\nUse the registry editor to examine the key.");
Console.WriteLine("Press the Enter key to delete the key.");

방법: 쿠키 작성

방법: 쿠키 작성.


ASP.NET AJAX Control Toolkit

Welcome to the ASP.NET AJAX Control Toolkit.


Choose from any of the samples on the left to see the live controls in action, and experiment with their different possibilities.

What is the ASP.NET AJAX Control Toolkit?

The ASP.NET AJAX Control Toolkit is an open-source project built on top of the […]

Creating custom, language specific error pages in IIS – benjamin perkins – Site Home – MSDN Blogs

Creating custom, language specific error pages in IIS – benjamin perkins – Site Home – MSDN Blogs.

iPhone 개발, 웹앱, SenchaTouch, Corona, Cappuccino, Phonegap, Mono Touch, xcode, ios, iphone

iPhone 개발, 웹앱, SenchaTouch, Corona, Cappuccino, Phonegap, Mono Touch, xcode, ios, iphone.

[ASP.NET] 잠재적 위험이 있는 Request.Form 값을 발견했습니다.

클라이언트 ( )에서 잠재적 위험이 있는 Request.Form 값을 발견했습니다.

사용 중인 .NET 프레임워크 버전이 4.0이라면 web.config 에 아래 코드를 넣어주는 것으로 해결이 가능합니다.

<system.web> <httpRuntime requestValidationMode=”2.0″/>

C# Abstract Keyword

C# Abstract Keyword.

[C#] DB 에서 XML 형식으로 가져오기

DataSet Sales;

//SQL 연결설정 SqlConnection sqlConnection; SqlDataAdapter sqlDataAdapter;

sqlConnection = new SqlConnection(connectionString);

try { sqlDataAdapter = new SqlDataAdapter(“Sales”, sqlConnection); sqlDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;

SqlParameter paramAGENT = new SqlParameter(“@AGENT”, SqlDbType.VarChar, 20); paramAGENT.Value = AGENT; sqlDataAdapter.SelectCommand.Parameters.Add(paramAGENT);

SqlParameter paramLanguage = new SqlParameter(“@Language”, SqlDbType.VarChar, 2); paramLanguage.Value = Language; sqlDataAdapter.SelectCommand.Parameters.Add(paramLanguage); //

Sales= new DataSet(); […]

c# select case

//요일구하기 public static string GetDay(string FLI_DAY) { string tempGetDay = string.Empty;

switch (FLI_DAY) { case “MO”: tempGetDay = “월”; break; case “TU”: tempGetDay = “화”; break; case “WE”: tempGetDay = “수”; break; case “TH”: tempGetDay = “목”; break; case “FR”: tempGetDay = “금”; break; case “SA”: tempGetDay = “토”; break; case “SU”: tempGetDay […]

xml Element and Attribute 추가 (Creating New Element and Attribute)

XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlPSW5);

XmlNodeList node = doc.GetElementsByTagName(“ETR_INF”); for (int i = 0; i < node.Count; i++) { //attribute 추가 XmlAttribute newAttribute = doc.CreateAttribute(“LocationName”); newAttribute.Value = ARL_COD_Name; node.Item(i).SelectSingleNode(“ARL_COD”).Attributes.Append(newAttribute);

//Element 추가 방법 1 XmlElement newElement = doc.CreateElement(“DEP_DAT”); XmlText newtext = doc.CreateTextNode(FLI_DAT); newElement.AppendChild(newtext); node.Item(i).AppendChild(newElement);

//Element 추가 방법 2 String sGRAND_TOTAL = “<GRAND_TOTAL><GRAND_AMT>” + GRAND_TOTAL […]

C# SoapSample credentials (ID Password)

using System.Xml; using System.Net; using System.IO; using System.Text; namespace UniRecord { public class SoapClass { public static string CallWebService() { var _url = "https://test.com/B2BGateway/connect/uAPI"; var _action = "https://test.com/uAPI/UniversalRecordService"; //EndPoint XmlDocument soapEnvelopeXml = CreateSoapEnvelope(); HttpWebRequest webRequest = CreateWebRequest(_url, _action); InsertSoapEnvelopeIntoWebRequest(soapEnvelopeXml, webRequest); // begin async call to web request. IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null); // suspend this thread until call is complete. You might want to
// do something usefull here like update your UI.

// get the response from the completed web request.
string soapResult;
using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult))
using (StreamReader rd = new StreamReader(webResponse.GetResponseStream()))
soapResult = rd.ReadToEnd();
return soapResult;

private static HttpWebRequest CreateWebRequest(string url, string action)
string credentials = "ID:Password";
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(action); //action 사용
webRequest.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials)));
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";

return webRequest;

private static XmlDocument CreateSoapEnvelope()
XmlDocument soapEnvelop = new XmlDocument();
soapEnvelop.LoadXml(@"<soapenv:Envelope xmlns:soapenv=’http://schemas.xmlsoap.org/soap/envelope/’ xmlns:univ=’http://www.travelport.com/schema/universal_v31_0′ xmlns:com=’http://www.travelport.com/schema/common_v31_0′>" +
"<soapenv:Header>" +
"<univ:SupportedVersions/>" +
"</soapenv:Header>" +
"<soapenv:Body>" +
"<univ:UniversalRecordRetrieveReq TraceId=’trace’ AuthorizedBy=’user’ TargetBranch=’ID’ RetrieveProviderReservationDetails=’false’ ViewOnlyInd=’false’>" +
"<com:BillingPointOfSaleInfo OriginApplication=’UAPI’/>" +
"<univ:UniversalRecordLocatorCode>PNR001</univ:UniversalRecordLocatorCode>" +
"</univ:UniversalRecordRetrieveReq>" +
"</soapenv:Body>" +
return soapEnvelop;

private static void InsertSoapEnvelopeIntoWebRequest(XmlDocument soapEnvelopeXml, HttpWebRequest webRequest)
using (Stream stream = webRequest.GetRequestStream())


참조 : http://stackoverflow.com/questions/4791794/client-to-send-soap-request-and-received-respons

C# 기본 XSLTDefault.xslt

<?xml version=”1.0″ encoding=”utf-8″?> <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:msxsl=”urn:schemas-microsoft-com:xslt” exclude-result-prefixes=”msxsl”> <xsl:output method=”xml” indent=”yes”/>

<xsl:template match=”@* | node()”> <xsl:copy> <xsl:apply-templates select=”@* | node()”/> </xsl:copy> </xsl:template> </xsl:stylesheet> ______________C# sample________________

using System; using System.Collections.Generic; using System.Xml; using System.Xml.Xsl; using System.Xml.XPath;

– 중간 생략 – public XmlElement …… { XmlDocument docXml = new XmlDocument(); XslCompiledTransform xslt = new XslCompiledTransform(); StringWriter […]

C# 날짜 비교 달구하기 Months count

두 날짜 비교해서 달구하기 따로 함수가 없어 만들었는데. 문제는 달마다 마지막 일이 다르다는것 => MS에서도 모호해서 함수를 만들지 않은 것 같음

public static int MonthAgeFind(DateTime StartDate, DateTime EndDate) { int tempMonthCount = 0; int MonthCount = 0; bool tempFind = false;

for(int i=0;i= EndDate && tempFind==false) //큰 달 더한횟수구하기 { tempMonthCount = i; tempFind […]

c# 숫자만 추출 Regex

숫자만 추출할때 쓰면 된다. 반드시 숫자가 하나이상 있어야 됨. using System.Text.RegularExpressions;

string strText = “abc1234567ㅏㅣ” string strNum = “”; strNum = Regex.Replace(strText, @”\D”, “”); => 1234567 닷넷 정규식에서 \d는 숫자. \D는 숫자가 아닌 문자를 의미

c# – Append XML string block to existing XmlDocument – Stack Overflow

c# – Append XML string block to existing XmlDocument – Stack Overflow.