ASP에 URL을 인코딩하려면 Server 객체의 URLEncode 메쏘드를 사용하면 된다. 그럼 디코딩은 어떻게 하지? ASP환경이 아닌 환경- 예를 들면 도스창에서 VBScript로 스크립트를 짤 때 - 에서는 Server 객체가 제공이 안되는데 이곳에서는 인코딩이나 디코딩을 어떻게 해야 하는가?
여기에 대한 대안으로 사용할 수 있는 함수인 URLEncode, URLDecode를 소개한다.
'ASP'에 해당되는 글 5건
- 2008/04/24 [vbscript] URLEncode, URLDecode 함수
- 2008/04/23 SEED 암호화 컴포넌트 ECPlaza.Seed 소스 공개
- 2007/09/14 ASP에서 MSXML2.ServerXMLHTTP 사용하여 원격 웹서버 내용 갖고 오기
- 2007/09/04 XSS방지를 위한 ASP용 htmlspecialchars 함수
- 2007/01/30 MegaBBS - A free, fully featured message board!
사용법은 간단합니다.
ECPlazaSeed.dll을 다운로드 받은 다음 적당한 폴더에 복사한뒤
regsvr32 ECPlazaSeed.dll
을 하면 컴포넌트 등록이 끝납니다.
등록 확인은 테스트 스크립트를 다운 받아서
cscript test.vbs
를 도스창에서 실행해서 오류가 발생하지 않으면 제대로 둥록이 된 겁니다.
이 컴포넌트는 두가기 메쏘드를 제공합니다.
Encrypt(sPlainText, sKey)
sPlainText 평서문을 sKey를 가지고 SEED 암호화 및 Base64
인코딩한 결과를 반환합니다.
Decrypt(sCipherText, sKey)
sCipherText 암호문을 Base64 디코딩을 하고, SEED 복호화를
거쳐서 원 평서문을 반환합니다.
사용 예제
소스를 컴파일 하기 위해서는 Visual C++ 6가 필요합니다. 전 아직도 이걸 쓴답니다.ㅜ.ㅜ
Visual Stuio .Net에서는 컴파일 해보지 않앗습니다. 아마 컴파일이 안 될것 같습니다.
다운로드:
소스:
DLL :
테스트 스크립트 :
참고:
한국정보진흥원 SEED 알고리즘
SEED 알고리즘 - Java API
Seed알고리즘을 이용한 암호화 복호화 기능 수행하는 DLL 만들기
가장 기본적인 방법은 다음과 같다.
GET 메쏘드로 갖고온 HTML을 화면에 출력하는 루틴이다. 게시판등에 글을 쓰거나 할 때는 POST 메쏘드를 사용하는데 이 방법도 가능한다.
오류 처리는 Send 메쏘드를 호출하기 전에 On Error Resume Next를 적어주고 오류발생여부를 체크하면 된다.
<form method="post" action="test.asp">
<input type="text" name="test" value="<%=htmlspecialchars(Request("test"))%>">
<input type="submit">
</form>
<%
Function htmlspecialchars(sStr)
htmlspecialchars = Replace( sStr, "&", "&" )
htmlspecialchars = Replace( htmlspecialchars, ">", ">" )
htmlspecialchars = Replace( htmlspecialchars, "<", "<" )
htmlspecialchars = Replace( htmlspecialchars, """", """ )
htmlspecialchars = Replace( htmlspecialchars, "'", "'" )
End Function
%>
Unix systems have had great choices in message forum software for years, but until recently, ASP users have been limited to a small handful of quality ASP message boards. Finally MegaBBS combines the powerful features of PHP boards, along with the ease of programmability and installation of ASP! Although MegaBBS has only been publicly released since late June 2002, it has already gained a great following of other users and developers. Current uses of MegaBBS include corporate intranets, commercial websites, personal use, and universities! It supports MS-Access and SQL Server and can be setup and running in a matter of minutes.


ECPlazaSeed.zip
ECPlazaSeed.dll
test.vbs



댓글을 달아 주세요