我想做的一个判断网页是否存在并且实现跳转功能的网页!
先判断式aaa.htm是否存在,如果不存在的话,就跳转到bbb.htm,你觉得有什么好的方法吗?

解决方案 »

  1.   

    为何要这么做?你加一个error页面,给用户比较友好的提示就行了(上面还可以加些链接)。
      

  2.   

    我们试过这样的方法: private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    try
    {
    Response.Redirect("http://mail.gzzc.com.cn/mail");
    }
    catch (Exception ex)
    {
    Response.Redirect("http://219.137.250.116:8007/mail");
    } }都不知道什么原因只执行了catch那部分!没有执行try那部分!
      

  3.   

    要不,你先这样判断
    if(File.exist( path  ))
    {}else
    {}
    path为你要访问的文件的路径,当然文件名也要加
      

  4.   

    jiezhi(風依舊)说得没错啊,给用户一个比较友好的错误页面不就解决问题了?
      

  5.   

    你加一个error页面,给用户比较友好的提示
    然后给用户提示返回首页就可以了
      

  6.   

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    try
    {
    Response.Redirect("http://mail.gzzc.com.cn/mail",false);
    }
    catch (Exception ex)
    {
    Response.Redirect("http://219.137.250.116:8007/mail");
    } }
      

  7.   

    Response.Redirect("http://mail.gzzc.com.cn/mail");
    ========================>
    Response.Redirect("http://mail.gzzc.com.cn/mail",false);
      

  8.   

    http://community.csdn.net/Expert/topic/3216/3216411.xml?temp=.2874567
      

  9.   

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    try
    {
    Response.Redirect("http://mail.gzzc.com.cn/mail",false);
    }
    catch (Exception ex)
    {
    Response.Redirect("http://219.137.250.116:8007/mail");
    } }