다음 예제는 서버 측에서 편집 가능한 iframes를 얻는 SARS 기능을 구현합니다. 코드는 매우 간단하므로 여기서 고통에 대해 설명하지 않습니다. 코드는 다음과 같습니다.
getiframehtml.axpx
<%@ page language = "<a href ="http://dev.21tx.com/language/vb/ "target ="_ blank "> vb </a>"validatequest = false autoeventwireup = "false"
codebehind = "getiframehtml. <a href ="http://dev.21tx.com/web/asp/ "target ="_ blank "> asp </a> x.vb"inherits = "aspx <a href ="http://dev.21tx.com/web/ " 대상 = "_ blank"> 웹 </a> .getiframehtml "%>
<html>
<body>
<form id = "frmmain"method = "post"runat = "server">
<iframe id = "ifrhtml"name = "ifrhtml"> </iframe>
<br>
<asp : button id = "cmdsend"runat = "server"text = "제출"> </asp : button>
<입력 유형 = "hidden"name = "hidValue">
</form>
<cript>
ifrhtml.document.designmode = "on";
</스크립트>
</body>
</html>
getiframehtml.aspx.vb
공개 클래스 getiframehtml
System.web.ui.page를 상속합니다
System.web.ui.webcontrols.button으로 Cmdsend를 보호합니다
Ifrhtml을 System.web.ui.htmlcontrols.htmlgenericcontrol로 보호합니다
#영역 "웹 양식 디자이너 생성 코드"
'이 호출은 웹 양식 디자이너가 필요합니다.
<system.diagnostics.debuggerstepthrough ()> private sub initializecomponent ()
종료 서브
private sub page_init (byval sender as system.object, _
byval e As System.eventArgs)는 mybase.init을 처리합니다
'CodeGen :이 메소드 호출은 웹 양식 디자이너가 필요합니다.
'코드 편집기를 사용하여 수정하지 마십시오.
InitializeComponent ()
종료 서브
#end 지역
Private sub page_load (byval sender as system.object, _
byval e as system.eventargs)는 mybase.load를 처리합니다
cmdsend.attributes.add ( "onclick", "document.frmmain.hidvalue.value" + _
"= ifrhtml.document.body.innerhtml;")
종료 서브
private sub cmdsubmit_click (byval sender as system.object, _
Byval e As System.eventArgs)는 cmdsend.click을 처리합니다
문자열로 명성을 희미하게합니다
strvalue = request.form ( "hidValue")
response.write (server.htmldecode (strvalue))
종료 서브
End Class는 회원을 등록하고 웹 개발 데이터베이스를 만듭니다.