本机测试没问题.到了服务器上发送报404错误.我的地址写成~/Index.aspx应该没问题啊.难道要物理路径? 
        //发送邮件
        if (mm != null)
        {
            client.Send(mm);
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('发送成功!感谢您的支持')</script>");
            Response.Redirect("~/Index.aspx");
        }
        else
        {
            return;
        }
发送完成后跳入主页.为什么总是404错误

解决方案 »

  1.   


    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('发送成功!感谢您的支持');window.location.href='~/Index.aspx'</script>");
    这样都获取不到.
      

  2.   

    if (mm != null)
      {
      client.Send(mm);
      this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('发送成功!感谢您的支持')</script>");
      Response.Redirect("Index.aspx");
      }
      else
      {
      return;
      }
      

  3.   

    你这个页面是否在当前网站中创建了文件夹了?iis会重启的,在这个过程中会报404