用asp。net2005怎样让url不论点击哪个页面都只显示首页地址?最好能提供完整例程代码,谢谢

解决方案 »

  1.   

    不是要连接到首页,是想在url地址栏一直只显示首页地址
      

  2.   

    可以在global.asax中处理 Application_BeginRequest(object sender, EventArgs e) 强制转到你的首页,但是与静态页和JS跳转到静态面可能不好处理使用URLRewrite
      

  3.   

    URLRewrite  或者是用 iframe
      

  4.   

    location.href=""
    Context.RewritePath
      

  5.   

    执行返回结果,不跳转
    Server.Execute(url);
      

  6.   

    <html>
    <body>
    <iframe id="main" frameborder="0" scrolling="auto" src="首页地址" width="" height="" style="z-index:2;"></iframe>
    </body>
    </html>
      

  7.   

    Server.Transfer()这个方法,浏览器会跳转但是Url内容不会变,不过这样浏览器压力会变大!~
      

  8.   

    iframe
    顶,
    不过,我觉得你没必要都显示成首页地址,你可以把其它页面弄成别加密过后的URL地址,
      

  9.   

     <iframe src="#" name="main"></iframe>点的连接
    <a href="要的显示的页面" target="main">
      

  10.   

    url重写好像不行吧. 觉得最简单就是用iframe, 
    或者像google一样, 用ajax.
      

  11.   

    有的一些做法,只有一个首页呢。其他页面全部通过参数动态生成。----
    Server.Transfer
      

  12.   


    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MainFrm.aspx.cs" Inherits="Mainframe_MainFrm" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Love</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" />
        <meta content="C#" name="CODE_LANGUAGE" />
        <meta content="JavaScript" name="vs_defaultClientScript" />
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" />
        <link type="text/css" href="/CSS/common.css" rel="Stylesheet" />
    </head>
    <frameset rows="56,*,0" framespacing="0" marginwidth="0" marginHeight="0" LEFTMARGIN="0" TOPMARGIN="0">
       <frame name="frmTop" src="TopFrm.aspx" scrolling="no" noresize="noresize" frameborder="0"/>
        <frame name="frmBody"   src="BodyFrm.aspx" scrolling="no" noresize="noresize" frameborder="0"/>
        <frame name="frmFoot" src="FootFrm.aspx" scrolling="no" noresize="noresize" frameborder="0"/> 
    </frameset>
    </html>
    用JS动态替换frame的src,页面永远只显示“Love” ...
      

  13.   

    我主要是想用来防止人家直接打url地址访问功能页面而已,因为我只有首页设了用户检验,(ps:vb语言的!新手 不是很懂该怎么实现!大家如果有好建议就传授一下 ,分数不够我可以加!谢谢大家啦)
      

  14.   


    sessin["username"]== null 就跳到首页
      

  15.   

    <frameset cols="190,*" framespacing="0" border="0" frameborder="0">
      <frame name="menu" target="main" marginwidth="0" marginheight="0" scrolling="auto" noresize src="left.aspx">
      <frame name="main" marginwidth="0" marginheight="0" scrolling="auto" noresize src="main.aspx">
      <noframes>
      <body topmargin="0" leftmargin="0">  <p>此网页使用了框架,但您的浏览器不支持框架。</p>  </body>
      </noframes>
    </frameset>
    <td class="style1" onmouseout="javascript:this.className='lt0';"
        onclick="javascript:top.main.location.href='link.aspx'" 
        onmouseover="javascript:this.className='lt1';" align="center"><span class="x">友情连接</span></td>
    <iframe runat="server" id="fileMain" name="fileMain"
                scrolling="yes" marginwidth="0" marginheight="0" frameborder="0" 
                style="height: 535px; padding-left:0px; width:800px;" src=""></iframe>
    <a href="ManagerBuinessForm.aspx" target="fileMain">管理公司形象</a>我感觉还是用框架好,只是我用的两个框架