ÈÃASP.Net HTMLÒ³Ãæ´úÂë ÇåˬÆðÀ´
×Ô´ÓÓÃÁË ASP.Net MVCºó¾Íϲ»¶ÉÏÁËËü £¬ÒòΪMVC¶Ô·þÎñÆ÷¿Ø¼þµÄÒÀÀµ´ó´ó¼õÉÙ£¬ËüÉú³ÉµÄHTMLÒ³Ãæ¾Í±ÈWebFormÇåˬ¶àÁË£¬¼ÓÔØËÙ¶ÈÓÐÁËÃ÷ÏԵĸÄÉÆ¡£
µ«¶ÔÓÚÒ³ÃæÖÐÄÚǶscript£¬»¹ÊDz»Äܳ¹µ×µÄ±ÜÃ⣬È磺
<script type="text/javascript" language="javascript">
//<!--
function DepositPage() {
// ÕâÊÇÒ»¸öµÚ3·½µÄWebControl,ÓÉÓÚÊÇ·þÎñÆ÷¿Ø¼þ£¬ÊÜMasterPageÓ°Ïì,ËüµÄ¿Í»§¶ËID²¢²»ÊÇÈ·¶¨µÄ¡£
this.ctrlRadGrid = "#<%= ctrlRadGrid.ClientID %>";
// ÕâÊÇÒ»¶ÎÓÖ³ôÓÖ³¤µÄJSON£¬´ÓModalÖд«µÝ¹ýÀ´
this.accounts = <%= Modal.JSON %>;
// .............................
}
new DepositPage();
// -->
</script>
ÊÇ·ñÓÐÒ»ÖÖ·½·¨¿ÉÒÔ½«Õâ¶ÎJS²»ÄÚǶÔÚHTMLÖУ¬Ê¹ÓÃ<script src="">±ê¼Ç´ÓÍⲿÎļþ¼ÓÔØ?
´ð°¸Êǿ϶¨µÄ£¬Í¨¹ý×Ô¶¨ÒåWebControlÍêÈ«¿ÉÒÔʵÏÖ£¬ÓÐÈçÏÂWebControl
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
[ParseChildren(false)]
public class ExternalJavascriptControl : WebControl
{
private string SafeFilenamePrefix
{
get
{
return Regex.Replace( this.ClientID
, "(\\\\|\\/|\\:|\\*|\\?|\\\"|\\<|\\>|\\|)"
, "_"
, RegexOptions.ECMAScript | RegexOptions.Compiled
);
}
}
protected override void Render(HtmlTextWriter writer)
{
if (!Visible)
return;
try
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
base.Render(htw);
// get the rendered content
string rendered = sw.ToString();
// remove the script tag if exist
rendered = Regex.Replace(rendered
, @"(<[\s\/]*script\b[^>]*>)"
, string.Empty
, RegexOptions.ECMAScript | RegexOptions.Compiled | RegexOptions.IgnoreCase
);
// get the file pa
Ïà¹ØÎĵµ£º
EvalÊÇasp.net1.1Öг£
Óõİó¶¨Óï·¨£¬ËüÊÇ“µ¥Ïò”µÄ£¬¼´°ó¶¨Ê±°ÑÊý¾ÝÔ´ÉÏÏàÓ¦µÄÖµ¸³µ½¸Ã¿Ø¼þÉÏ£¬EvalµÄÈÎÎñ¾ÍÍê³ÉÁË
¶øBindËùνµÄ“Ë«Ïò”¾ÍÊÇ£ºÔÚ°ó¶¨Ê±£¬°Ñ
Êý¾ÝÔ´ÉÏÏàÓ¦µÄÖµ¸³µ½¸Ã¿Ø¼þÉÏ£¬²¢ÇÒ£¬ÔÚÌύʱ£¬×Ô¶¯ÌáÈ¡Óû§ÔڸÿؼþÉÏÊäÈëµÄÖµ¡£
Code
<
EditItemTemplate
>
&nb ......
metaÊÇÓÃÀ´ÔÚHTMLÎĵµÖÐÄ£ÄâHTTPÐÒéµÄÏìӦͷ±¨ÎÄ¡£meta
±êÇ©ÓÃÓÚÍøÒ³µÄ<head>Óë</head>ÖУ¬meta ±êÇ©µÄÓô¦ºÜ¶à¡£meta
µÄÊôÐÔÓÐÁ½ÖÖ£ºnameºÍhttp-equiv¡£nameÊôÐÔÖ÷ÒªÓÃÓÚÃèÊöÍøÒ³£¬¶ÔÓ¦ÓÚcontent£¨ÍøÒ³ÄÚÈÝ£©£¬ÒÔ±ãÓÚËÑË÷ÒýÇæ»úÆ÷È˲éÕÒ¡¢·ÖÀࣨĿ
Ç°¼¸ºõËùÓеÄËÑË÷ÒýÇ涼ʹÓÃÍøÉÏ»úÆ÷ÈË×Ô¶¯²éÕ ......
×î½ü¹«Ë¾ÐèÒª¿ª·¢Ò»¸ö¼òÀúµ¼È빦ÄÜ£¬ÀàËƲ©¿Í°á¼Ò»òÕßÓÊÏä°á¼Ò£¬Ö®Ç°×¥È¡ÐÅÏ¢ÊÇÀûÓû𳵲ɼ¯Æ÷£¬µ«ÊǼòÀúµ¼È빦ÄÜÐèÒªÓû§µÇ½ÒÔºó²ÅÄÜ»ñÈ¡¼òÀúÊý¾Ý£¬ÎÞÄÎÖ»ºÃ×Ô¼º¿ª·¢ÁË¡£
Ê×ÏÈÊÇÓöµ½µÄÎÊÌâÊÇ£ºÈçºÎʵÏÖÄ£ÄâµÇ½£¿
ÎÒÃÇÖªµÀÒ»°ãµÄÍøÕ¾¶¼ÊÇͨ¹ýCookiesÀ´Î¬»¤×´Ì¬µÄ£¬ÎÒ×¥µÄÍøÕ¾Ò²ÊÇÖ§³ÖÀûÓÃCookiesÀ´ÑéÖ¤Óû§µÄ£¬¹¹ÔìÒ»¸ö ......
ÎÒÓÐÒ»¸ölogin.aspxµÄÒ³Ãæ,¼ÙÈçµÇ¼³É¹¦ºó¾Í»á×Ô¶¯Ìøתµ½index.htmlµÄ¿ò¼Ü.
index.htmlÓÐÈý¸öÒ³Ãæ,top.aspx,left.aspx,main.aspx,È»ºóleft.aspxÀïÃæÏÔʾÓû§ÐÅÏ¢
¼ÙÈçÔÚleft.aspxÀïûÓÐSessionµÄ»°,»á·µ»Ølogin.aspxÒ³Ãæ,¶ø²»ÏÔʾindex.htmlÒ³ÃæÀïµÄÈκÎÒ»Ò³.
ÎÒÏÖÔÚµÄÇé¿öÊÇûÓÐSessionµÄʱºò»¹ÊÇÔÚi ......