Shabdar.org
Webshabdar.org
Cannot convert type ASP.login_aspx to System.Web.UI.WebControls.Login PDF Print E-mail
Written by Shabdar   
Tuesday, 25 November 2008 09:56

Problem

You get following error when you run ASP.Net login page
Cannot convert type ASP.login_aspx to System.Web.UI.WebControls.Login

Solution


  • Go to your login.aspx.cs code behind file.
  • Find line where page class is defined.
    public partial class Login : System.Web.UI.Page
    
  • Rename this class to something else. For example,
    public partial class clsLogin : System.Web.UI.Page
    
  • Now go to your webform code in login.aspx file. And change inherit attribute to point to clsLogin class.
    <%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" 
    CodeFile="Login.aspx.cs" Inherits="Login" %>

    Change this to,
    <%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" 
    CodeFile="Login.aspx.cs" Inherits="clsLogin" %>

This should solve your problem

Cause

Login is treated as a reserve word in ASP.Net. If you use it for your class name, it conflicts with existing ASP.Net Login class.

Comments/Questions


that was realy nice blog i got my prob solve in a min...
thanx to this.
hope for best.
=> Darshan Thacker (Tuesday 01-Apr-08 06:39 AM)
 
 
{mos_fb_discuss:12}
Comments
Add New Search
+/-
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
Please input the anti-spam code that you can read in the image.
Last Updated on Tuesday, 30 March 2010 09:14