2012-05-15 132 views
0

我不知道有什麼可以在這裏失蹤,但我不斷收到此錯誤,未能加載類型「CwizBankApp.HomeLogin」

Parser Error 

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'CwizBankApp.HomeLogin'. 

Source Error: 


Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HomeLogin.aspx.cs" Inherits="CwizBankApp.HomeLogin" %> 
Line 2: 
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

Source File: /HomeLogin.aspx Line: 1 

Here is the code behind file 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.Security; 

namespace CwizBankApp 
{ 
    public partial class HomeLogin : System.Web.UI.Page 
    { 
     protected void Page_Load(object sender, EventArgs e) 
     { 
      //Membership.DeleteUser("ppp002"); 

      if (Request.QueryString["session"] =="new_session") 
      { 
       Session.Abandon(); 
       FormsAuthentication.SignOut(); 
       Response.Redirect("/HomeLogin.aspx"); 


      } 
      //Useful when using role based access because if an authenticated user is sent here that means he is trying to view a page he is not allowed to 
      if (Request.IsAuthenticated && !string.IsNullOrEmpty(Request.QueryString["ReturnUrl"])) 
      { 
       Response.Redirect("/UnauthorizedAccess.aspx"); 

      } 



     } 

     protected void cmdLogin_Click(object sender, EventArgs e) 
     { 
      if (Membership.ValidateUser(txtUsername.Text, txtPassword.Text)) 
      { 
       HttpCookie authCookie = FormsAuthentication.GetAuthCookie(txtUsername.Text, false); 
       FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); 
       FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, ticket.IssueDate, ticket.Expiration, ticket.IsPersistent, ""); 
       authCookie.Value = FormsAuthentication.Encrypt(newTicket); 
       Response.Cookies.Add(authCookie); 
       GetUserName(); 
       string redirUrl = FormsAuthentication.GetRedirectUrl(txtUsername.Text, false); 
       Response.Redirect(redirUrl); 

      } 


     } 
     public void GetUserName() 
     { 
      DataClasses1DataContext dt = new DataClasses1DataContext(); 
      var name =(from nm in dt.Users_AdditionalInfos 
         where nm.UserCode== txtUsername.Text.Trim() 
         select nm).Single(); 
      Global.UserName=name.FirstName +" "+ name.LastName; 
     } 

     protected void cmdCreateUser_Click(object sender, EventArgs e) 
     { 

      Response.Redirect("/CreateAccount.aspx"); 
     } 
    } 
} 

我也檢查了下我的項目的bin文件夾中的dll不存在,可以有人幫我解決這個問題。 歡迎任何建議。 感謝

+0

請顯示後面的代碼。它應該有一個名爲CwizBankApp的名稱空間,類名應該是HomeLogin,否則它將無法找到代碼。 –

+0

@KevinMain我編輯了我的問題 – freebird

+0

當你構建它時,你有任何錯誤嗎? –

回答

1

首先檢查命名空間是CwizBankApp和類名是HomeLogin。

現在重建 - 不構建成功還是失敗?如果它失敗,dll不會被創建,因此你會得到錯誤,檢查所有的錯誤信息並修復問題,然後重新生成。

相關問題