Click here to Skip to main content
15,921,113 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralSessions Pin
ADY00712-Mar-07 22:49
ADY00712-Mar-07 22:49 
AnswerRe: global variables Pin
N a v a n e e t h12-Mar-07 22:23
N a v a n e e t h12-Mar-07 22:23 
GeneralRe: global variables Pin
vengaqua12-Mar-07 22:47
vengaqua12-Mar-07 22:47 
GeneralRe: global variables Pin
amin_behzadi13-Mar-07 0:10
professionalamin_behzadi13-Mar-07 0:10 
Questionhow to conver year to dateTime format Pin
ramyasangeet12-Mar-07 21:30
ramyasangeet12-Mar-07 21:30 
AnswerRe: how to conver year to dateTime format Pin
Sandeep Akhare12-Mar-07 22:11
Sandeep Akhare12-Mar-07 22:11 
GeneralRe: how to convert year to dateTime format Pin
ramyasangeet12-Mar-07 22:17
ramyasangeet12-Mar-07 22:17 
QuestionLogin error Pin
reddyamar_uk12-Mar-07 21:12
reddyamar_uk12-Mar-07 21:12 
I tried to use below code for my login page. But I am getting below 4 errors which I am unable to resolve. Can you help me please.

using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
<br />
namespace WebSite2<br />
{<br />
    /// <summary><br />
    /// Summary description for Login.<br />
    /// </summary><br />
    public class Login : System.Web.UI.Page<br />
    {<br />
        protected System.Web.UI.WebControls.Label LabelError;<br />
        protected System.Web.UI.WebControls.Button ButtonLogin;<br />
        protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;<br />
        protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;<br />
        protected System.Web.UI.WebControls.Label Label1;<br />
        protected System.Web.UI.WebControls.TextBox txtpassword;<br />
        protected System.Web.UI.WebControls.Label Label2;<br />
        protected System.Web.UI.WebControls.TextBox txtusername;<br />
<br />
        private void Page_Load(object sender, System.EventArgs e)<br />
        {<br />
            // Put user code to initialize the page here<br />
        }<br />
<br />
        #region Web Form Designer generated code<br />
        override protected void OnInit(EventArgs e)<br />
        {<br />
            //<br />
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.<br />
            //<br />
            InitializeComponent();<br />
            base.OnInit(e);<br />
        }<br />
<br />
        /// <summary><br />
        /// Required method for Designer support - do not modify<br />
        /// the contents of this method with the code editor.<br />
        /// </summary><br />
        private void InitializeComponent()<br />
        {<br />
            this.Buttonlogin.Click += new System.EventHandler(this.Buttonlogin_Click);<br />
            this.Load += new System.EventHandler(this.Page_Load);<br />
<br />
        }<br />
        #endregion<br />
<br />
        private void buttonlogin_Click(object sender, System.EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                LabelError.Visible = false;<br />
                string uid, pwd;<br />
                uid = txtusername.Text;<br />
                pwd = txtpassword.Text;<br />
                string accessLevel = CheckPassword(uid, pwd);<br />
                if (accessLevel != "")<br />
                {<br />
                    Session["UID"] = uid;<br />
                    Session["AccessLevel"] = accessLevel;<br />
                    //FormsAuthentication.RedirectFromLoginPage (uid, false);<br />
                    //string str = (string)(Session["RequestedPage"]);<br />
                    Response.Redirect("Page2.aspx");<br />
<br />
                }<br />
                else<br />
                {<br />
                    LabelError.Visible = true;<br />
                }<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                ex.ToString();<br />
            }<br />
        }<br />
        private string CheckPassword(string uid, string pwd)<br />
        {<br />
            return "1";<br />
            // Following is the code if you want to add username and password in a database for checking the credentials.<br />
<br />
            /*string connStr="server=guddu;uid=sa;pwd=;database=university";<br />
            SqlConnection conn=new SqlConnection(connStr);<br />
<br />
            string sql = "select userid from registereduser where name='" +<br />
                uid + "' and password='"+pwd+"'";<br />
            SqlCommand comm=new SqlCommand(sql, conn);<br />
            conn.Open();<br />
            Object obj = comm.ExecuteScalar();// returns one row<br />
            string userid = "";<br />
            if (obj != null)<br />
                userid = obj.ToString();  // AccessLevel column<br />
<br />
            string strRole = "";<br />
            sql = "select role from role where roleid='" +<br />
                userid + "'";<br />
            SqlConnection conn2 = new SqlConnection(connStr);<br />
            SqlCommand comm2 =new SqlCommand(sql, conn2);<br />
            conn2.Open();<br />
            obj = comm2.ExecuteScalar();// returns one row<br />
            if (obj != null)<br />
                strRole = obj.ToString();  // AccessLevel column<br />
            conn2.Close();<br />
            conn.Close();<br />
            return strRole;<br />
*/<br />
        }<br />
        private void btnNewUser_Click(object sender, System.EventArgs e)<br />
        {<br />
            //RequiredFieldValidator1.Enabled = false;<br />
            //RequiredFieldValidator2.Enabled = false;<br />
            Response.Redirect("NewUser.aspx");<br />
        } <br />
    }<br />
}


Below are the Errors.
Error 4 Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl). C:\Documents and Settings\Amarnath\My Documents\Visual Studio 2005\WebSites\WebSite2\Login.aspx.cs 1 33 C:\...\WebSite2\

Error 1 'ASP.login_aspx.GetTypeHashCode()': no suitable method found to override c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website2\34e44d00\b8acac28\App_Web_imunwsug.0.cs 870

Error 2 'ASP.login_aspx.ProcessRequest(System.Web.HttpContext)': no suitable method found to override c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website2\34e44d00\b8acac28\App_Web_imunwsug.0.cs 874

Error 3 'ASP.login_aspx' does not implement interface member 'System.Web.IHttpHandler.IsReusable' c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website2\34e44d00\b8acac28\App_Web_imunwsug.0.cs 192
AnswerRe: Login error Pin
Sandeep Akhare12-Mar-07 22:18
Sandeep Akhare12-Mar-07 22:18 
GeneralRe: Login error Pin
reddyamar_uk13-Mar-07 1:17
reddyamar_uk13-Mar-07 1:17 
AnswerRe: Login error Pin
Harini N K13-Mar-07 1:50
Harini N K13-Mar-07 1:50 
QuestionError in exporting crystal report to pdf Pin
Sylvester george12-Mar-07 21:07
Sylvester george12-Mar-07 21:07 
AnswerRe: Error in exporting crystal report to pdf Pin
N a v a n e e t h12-Mar-07 22:44
N a v a n e e t h12-Mar-07 22:44 
AnswerRe: Error in exporting crystal report to pdf Pin
Harini N K12-Mar-07 23:56
Harini N K12-Mar-07 23:56 
GeneralRe: Error in exporting crystal report to pdf Pin
Sylvester george13-Mar-07 0:07
Sylvester george13-Mar-07 0:07 
QuestionPage Resizing Pin
jithbiz003312-Mar-07 21:00
jithbiz003312-Mar-07 21:00 
QuestionDisplay a week number Pin
Oga M12-Mar-07 20:58
Oga M12-Mar-07 20:58 
AnswerRe: Display a week number Pin
Spunky Coder12-Mar-07 21:10
Spunky Coder12-Mar-07 21:10 
QuestionIUSR Issue - Please Help Pin
Programm3r12-Mar-07 20:54
Programm3r12-Mar-07 20:54 
Questiondynamically ading coumn to grid help Pin
nikhil123412-Mar-07 20:48
nikhil123412-Mar-07 20:48 
AnswerRe: dynamically ading coumn to grid help Pin
varshavmane12-Mar-07 23:03
varshavmane12-Mar-07 23:03 
QuestionParent page control Pin
Kanjinghat12-Mar-07 19:48
Kanjinghat12-Mar-07 19:48 
QuestionWeb.Config File Pin
Saranya B12-Mar-07 19:56
Saranya B12-Mar-07 19:56 
AnswerRe: Web.Config File Pin
Spunky Coder12-Mar-07 21:01
Spunky Coder12-Mar-07 21:01 
GeneralRe: Web.Config File Pin
Saranya B12-Mar-07 23:39
Saranya B12-Mar-07 23:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.