当前位置:编程学习 > C#/ASP.NET >>

无法找到资源。 说明: HTTP 404。您正在查找的资源(或者它的一个依赖项)可能已被移除,或其名称已更改,或暂时不可用。请检查以下 URL 并确保其拼写正确

法找到资源。
说明: HTTP 404。您正在查找的资源(或者它的一个依赖项)可能已被移除,或其名称已更改,或暂时不可用。请检查以下 URL 并确保其拼写正确。

请求的 URL: /Aquaculture/department/Purchase.aspx
请高手们帮忙看看,是哪写错了,这是登录的后台,我想实现选择不同部门,跳转到不同页面,然后就一直报上面那个错误
代码如下:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using GROUP.Manage;
using System.Data.SqlClient;

public partial class Login : System.Web.UI.Page
{
    BaseClass BaseClass1 = new BaseClass();
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void LoginButton_Click(object sender, EventArgs e)
    {
        if (UserID.Text != "" && Password.Text != "")//判断用户密码是否为空
        {
            SqlConnection Conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=D:\\Aquaculture\\App_Data\\Database.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");

            Conn.Open();
            //连接数据库 判断用户输入的用户名,密码和选择的角色是否正确
            string strsql = "select * from tab_hr_staff where 员工工号='" + UserID.Text + "'and 密码='" + Password.Text + "'and 所属部门='" + DropDownList1.SelectedValue + "'";

            SqlCommand Comm = new SqlCommand(strsql, Conn);
            Comm.Connection = Conn;
            SqlDataReader read = Comm.ExecuteReader();
            if (read.Read())
            {    
                //判断用户身份跳转到不同页面

                if (DropDownList1.SelectedValue == "采购部")
                {
                    Response.Redirect("~/department/Purchase.aspx");
                }
                else if (DropDownList1.SelectedValue == "设备管理部")
                {
                    Response.Redirect("EquipmentControl.aspx");
                }
                else if (DropDownList1.SelectedValue == "生产部")
                {
                    Response.Redirect("ProductionControl.aspx");
                }
                else if (DropDownList1.SelectedValue == "销售部")
                {
                    Response.Redirect("SalesControl.aspx");
                }
                else if (DropDownList1.SelectedValue == "人事部")
                {
                    Response.Redirect("HR.aspx");
                }
                else if (DropDownList1.SelectedValue == "财会部")
                {
                    Response.Redirect("FinanceControl.aspx");
                }
                else if (DropDownList1.SelectedValue == "总经理")
                {
                    Response.Redirect("Manager.aspx");
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }
                Conn.Close();
            }

            else
            {
                //弹出用户,密码错误提示

                Response.Write("<script>alert('用户名或密码错误');location.href = 'Login.aspx';</script>");
                return;
            }
        }
        else
        {

            //弹出用户密码为空提示
            Response.Write("<script>alert('用户名和密码不得为空');location.href = 'Login.aspx';</script>");
            return;
        }

    }
}
--------------------编程问答-------------------- ~/department/Purchase.aspx
检查一下此路径是否正确 --------------------编程问答-------------------- 跟代码没关系把,就是路径的问题 --------------------编程问答-------------------- 请求的 URL: /Aquaculture/department/Purchase.aspx
这个路径是否正确 --------------------编程问答-------------------- 路径是正确的。。。。
--------------------编程问答-------------------- 谢谢各位,确实是路径问题,多谢了 --------------------编程问答-------------------- 检查此路径下是否存在这个页面! --------------------编程问答-------------------- 肯定是路径不对,或者是页面的名称不对,如果这些都对的话就分别用绝对路径和相对路径试试,问题就知道出在哪里了,解决起来也快! --------------------编程问答-------------------- 怎么解决的啊? --------------------编程问答-------------------- 正确的路径应该是什么 --------------------编程问答-------------------- 我遇到了,恢复之前的web.config就可以了 --------------------编程问答--------------------
引用 10 楼 u011078598 的回复:
我遇到了,恢复之前的web.config就可以了

我也遇到这样的问题,请问怎么恢复的? --------------------编程问答-------------------- 请求的 URL: /CourseManage/Teacher/Login.aspx
我也遇到类似的问题,Login.aspx的路径是: /CourseManage/Login.aspx;根本就不在Teacher下,怎么会无法跳转?求解答。 --------------------编程问答-------------------- 请求的 URL: /WebSiteTestOnline06/login.aspx
login.aspx路径应该是: /WebSiteTestOnline06/Account/login.aspx

怎么办
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,