使用Ajax读取aspx页面源代码

我用prototype.js框架来做Ajax,可当我读取aspx的页面源代码时,怎么跟我用浏览器访问aspx文件时的源代码怎么不一样啊?
例如:test.aspx
   它的前台页面源代码是
 1 None.gif <% @ Page Language = " C# "  AutoEventWireup = " true "  CodeFile = " test.aspx.cs "  Inherits = " test "   %>
 2 None.gif
 3 None.gif <! DOCTYPE html PUBLIC  " -//W3C//DTD XHTML 1.0 Transitional//EN "   " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
 4 None.gif
 5 None.gif < html xmlns = " http://www.w3.org/1999/xhtml "   >
 6 None.gif < head runat = " server " >
 7 None.gif     < title > 无标题页 </ title >
 8 None.gif </ head >
 9 None.gif < body >
10 None.gif     < form id = " form1 "  runat = " server " >
11 None.gif     < div >
12 None.gif         < asp:Button ID = " Button1 "  runat = " server "  OnClick = " Button1_Click "  Text = " Button "   />< br  />
13 None.gif         < asp:HyperLink ID = " HyperLink1 "  runat = " server "  NavigateUrl = " login.aspx?ComeUrl=http://test.com.cn " > HyperLink </ asp:HyperLink >& nbsp; </ div >
14 None.gif     </ form >
15 None.gif </ body >
16 None.gif </ html >
17 None.gif
后台代码是
 1 None.gif using  System;
 2 None.gif using  System.Data;
 3 None.gif using  System.Configuration;
 4 None.gif using  System.Collections;
 5 None.gif using  System.Web;
 6 None.gif using  System.Web.Security;
 7 None.gif using  System.Web.UI;
 8 None.gif using  System.Web.UI.WebControls;
 9 None.gif using  System.Web.UI.WebControls.WebParts;
10 None.gif using  System.Web.UI.HtmlControls;
11 None.gif using  System.Drawing;
12 None.gif using  System.Drawing.Drawing2D;
13 None.gif using  System.Drawing.Imaging;
14 None.gif
15 None.gif public  partial  class  test : System.Web.UI.Page
16 ExpandedBlockStart.gifContractedBlock.gif dot.gif {
17InBlock.gif    private void Page_Load(object sender, EventArgs e)
18ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
19InBlock.gif        this.HyperLink1.Text = "234";
20InBlock.gif
21ExpandedSubBlockEnd.gif    }

22InBlock.gif
23InBlock.gif    protected void Button1_Click(object sender, EventArgs e)
24ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
25InBlock.gif
26ExpandedSubBlockEnd.gif    }

27InBlock.gif     
28ExpandedBlockEnd.gif}

29 None.gif





       我在它的page_load方法中写了如下字符

       
1 None.gif private   void  Page_Load( object  sender, EventArgs e)
2 ExpandedBlockStart.gifContractedBlock.gif     dot.gif {
3InBlock.gif        this.HyperLink1.Text = "234";
4InBlock.gif
5ExpandedBlockEnd.gif    }


当我用浏览器访问这个页面时,页面显示234,源代码如下
 1 None.gif
 2 None.gif
 3 None.gif<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 4 None.gif
 5 None.gif<html xmlns="http://www.w3.org/1999/xhtml" >
 6 None.gif<head><title>
 7 None.gif    无标题页
 8 None.gif</title></head>
 9 None.gif<body>
10 None.gif    <form name="form1" method="post" action="test.aspx" id="form1">
11 None.gif<div>
12 None.gif<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEyNjc1NzA0NzMPZBYCAgMPZBYCAgMPDxYCHgRUZXh0BQMyMzRkZGTaa2ddQKFj2kvAyF7Ggg2s4PtnCA==" />
13 None.gif</div>
14 None.gif
15 None.gif    <div>
16 None.gif        <input type="submit" name="Button1" value="Button" id="Button1" /><br />
17 None.gif         <a id="HyperLink1" href="login.aspx?ComeUrl=http://test..com.cn">234</a>&nbsp;</div>
18 None.gif    
19 None.gif<div>
20 None.gif
21 None.gif    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK/8tW8CQKM54rGBsRRq6lpWEZCKO/SL9pRz44W3fDK" />
22 None.gif</div></form>
23 None.gif</body>
24 None.gif</html>
25 None.gif




,但当我用prototype的 new Ajax.Request("test.aspx",{相关参数})来读取时,发现它读出的源代码竟然没有234,如下
读出来的源代码是
None.gif<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
None.gif
None.gif<html xmlns="http://www.w3.org/1999/xhtml" >
None.gif<head><title>
None.gif 无标题页
None.gif</title></head>
None.gif<body>
None.gif    <form name="form1" method="post" action="test.aspx" id="form1">
None.gif<div>
None.gif<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEyNjc1NzA0NzNkZOQVa4vKhp97DDEQEoO6wwXqNgJ8" />
None.gif</div>
None.gif
None.gif    <div>
None.gif        <input type="submit" name="Button1" value="Button" id="Button1" /><br />
None.gif         <a id="HyperLink1" href="login.aspx">HyperLink</a>&nbsp;</div>
None.gif
    
None.gif<div>
None.gif
None.gif <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLO2pDrDwKM54rGBiWg/jeI3Dj5CPRTiwsC64huUwbQ" />
None.gif</div></form>
None.gif</body>
None.gif</html>
None.gif





他读出的html源代码不是动态的html源代码,好像后面的page_load方法就没有运行一样?这怎么回事?
posted on 2007-05-21 19:12  netlynx2000 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/netlynx2000/archive/2007/05/21/754547.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值