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

网站以源代码在IIS中发布运行正常,编译以后发布运行不了。

如题。
但是目前提示说登陆界面错了。
以后的界面直接点击的是很由于判断用户是否登陆所以
就跳转到了登陆然后就错了。。。
错误如下:
编译错误 
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 

编译器错误信息: CS0030: 无法将类型“ASP.login_aspx”转换为“System.Web.UI.WebControls.Login”

源错误:

 

行 114:        public login_aspx() {
行 115:            string[] dependencies;
行 116:            ((Login)(this)).AppRelativeVirtualPath = "~/Login.aspx";
行 117:            if ((global::ASP.login_aspx.@__initialized == false)) {
行 118:                global::ASP.login_aspx.@__stringResource = this.ReadStringResource();
源文件: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\a\78eea67d\389e285b\App_Web_login.aspx.cdcab7d2.wdrkk5ux.0.cs    行: 116 


 我的页面后台代码如下。

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CYDZ.Models;
using CYDZ.BLL;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["user"] = null;
        }
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        TbusersInfo userInfo = new TbusersInfo();
        int index = txtName.Text.IndexOf(" ");
        int index1 = txtPwd.Text.IndexOf(" ");
        if (index1 <= 0)
        {
            if (index <= 0)
            {
                userInfo = TbusersBLL.Login(txtName.Text, txtPwd.Text);
                if (userInfo == null)
                {
                    lbError.Visible = true;
                }
                else
                {
                    if (userInfo.Strstate == "停用")
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToString(), "alert('当前用户还未激活,请联系管理员激活该用户...');", true);
                    }
                    else
                    {
                        TboptbelongInfo belong = TboptbelongBLL.GetModel(userInfo.Stroptcode);
                        if (belong == null)
                        {
                            ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToString(), "alert('当前用户还未取得权限,请联系管理员..');", true);
                        }
                        else
                        {
                            string strOptCode = belong.Strgroupcode.ToString();
                            TboptgroupInfo tbGrout = TboptgroupBLL.GetModel(strOptCode);
                            if (tbGrout == null)
                            {
                                ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToString(), "alert('当前用户没有登录权限,请联系管理员...');", true);
                            }
                            else
                            {
                                Session["user"] = txtName.Text.ToString();
                                Response.Redirect("Index.aspx");
                            }
                        }
                    }
                }
            }
            else
            {
                lbError.Visible = true;
                lbError.Text = "您输入的用户名不合法..";
            }
        }
        else 
        {
            lbError.Visible = true;
            lbError.Text = "您输入的密码不合法..";
        }
    }
   
    protected void btnReLogin_Click(object sender, EventArgs e)
    {
        txtName.Text = txtPwd.Text = null;
        
    }
}


重新编译过好几次了就是解决不了问题。
望高手解决下啊。。。。。
--------------------编程问答-------------------- ((Login)(this)).AppRelativeVirtualPath = "~/Login.aspx"; 

这行代码的问题。 --------------------编程问答-------------------- 运行时错误,虽然编译可以通过,运行时会抛错。 --------------------编程问答--------------------
引用 1 楼 zsuswy 的回复:
((Login)(this)).AppRelativeVirtualPath = "~/Login.aspx";

这行代码的问题。

帮忙下,后台代码不是可以看到么、
主要是后台代码中就没有那句代码啊,
我就不知道哪里错了啊。
给点明示啊。 --------------------编程问答-------------------- 命名冲突
Login.aspx中的Login类改名,与登录控件重名

页面类添加命名空间 
发布网站再部署 --------------------编程问答-------------------- Login.aspx中的Login类改名 _Login就可以了 ,  以前也遇到过这样的问题 --------------------编程问答-------------------- 楼上说的有道理,顶 --------------------编程问答-------------------- 我遇到过
Login.aspx.cs中的Login类改名
Login.aspx中的Inherits  改名

或者为你的程序加命名空间吧 --------------------编程问答-------------------- 应该还是你代码的问题,几位楼上的提出的意见可以参考一下
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,