코드가 클라이언트로 렌더링되기 전에 주석을 제거하려는 경우 주석을 변경하는 방법을 변경하십시오. 를 사용하여 서버 측 주석 = <%-- hi --%>
:
그래서 : 당신이 실제로으로 렌더링하기 전에 출력 HTML을 편집해야하는 경우,
<!-- Don't remove the <p> below because our stupid clients are too stupid to figure out this form without it -->
<p>Tip: The field labeled "First Name" is meant for your first name. Don't type in your last name in this box.</p>
<p>Tip 2: Type your last name in the field labeled "Last Name".</p>
그러나 :
<!-- Don't remove the <p> below because our stupid clients are too stupid to figure out this form without it -->
<p>Tip: The field labeled "First Name" is meant for your first name. Don't type in your last name in this box.</p>
<%-- Don't remove this <p> either because both our clients and our boss are too dumb to figure it out --%>
<p>Tip 2: Type your last name in the field labeled "Last Name".</p>
는 다음과 같이 표현 될 것인가 클라이언트를 글로벌 규모로 사용하면 코드에서 수정할 수 없으므로 마스터 페이지에서이 작업을 수행 할 수 있습니다.
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
StringWriter sw = new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
base.Render(tw);
string yourHTML = sw.ToString();
// do stuff with yourHTML
writer.Write(yourHTML);
tw.Dispose();
sw.Dispose();
}
당신은 코드가있는 경우 매우
간단한 예
그래서,
<h1>I'm a big fat h1</h1>
당신은 그 함수의 수 : 그래서 지금 그 위의 코드
<h5>I'm a big fat h1</h5>
로 렌더링됩니다
yourHTML = yourHTML.Replace("<h1>","<h5>");
yourHTML = yourHTML.Replace("</h1>", "</h5>");
을
모든 h1
태그를 01로 변경하는 합법적 인 요구 사항을 충족하려면을 브라우저로 렌더링하기 전에
웹 서버는 작업이 아닌 배포 프로세스에서 한 번만 수행해야합니다. – Maxim