Question

ASP.NET 3.5 login page (C#)

Asked by: haramsde

Hi experts

I'm trying to create a login page that will authenticate users that are in a SQL Server 2005 database. I'm creating the login page in Visual Studio 2008 Professional Edition (Trial Version).

The login page is fine, it's the class that is authenticating the user that I'm having problems with. It has given me errors with my case statement amongst other things and I'm not sure how to correct it.
Any help would be greatly appreciated.

Thanks

Login page:
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="SmartLearner.Login" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Secure Site</title>    
    <meta content="Microsoft Visual Studio 7.0" name="GENERATOR"/>    
    <meta content="C#" name="CODE_LANGUAGE"/>    
    <meta content="JavaScript" name="vs_defaultClientScript"/>    
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"/>  
    </head>  
    <body>    
    <form id="login" method="post" runat="server">      
    <table cellspacing="0" cellpadding="0" border="0">      
    <tr>        
    <td valign="top" align="left">          
    <asp:label id="Message" runat="server" ForeColor="#ff0000">          
    </asp:label>        
    </td>      
    </tr>      
    <tr>        
    <td valign="top" align="left">          
    <b>E-mail:</b>        
    </td>      
    </tr>      
    <tr>        
    <td valign="top" align="left">          
    <asp:textbox id="username" runat="server" Width="120">          
    </asp:textbox>        
    </td>      
    </tr>      
    <tr>        
    <td valign="top" align="left">          
    <b>Password:</b>        
    </td>      
    </tr>      
    <tr>        
    <td valign="top" align="left">          
    <asp:textbox id="password" runat="server" Width="120" textMode="Password">          
    </asp:textbox>        
    </td>      
    </tr>      
    <tr>        
    <td valign="top" align="left">          
    <asp:checkbox id="saveLogin" runat="server" text="<b>Save my login</b>">          
    </asp:checkbox>        
    </td>      
    </tr>      
    <tr>        
    <td valign="top" align="right">          
        &nbsp;</td>      
    </tr>      
    </table>    
        <asp:Button ID="btnLogin" runat="server" text="Login" />
    </form>  
    </body>
</html>
 
Class:
 
using System;
using System.Data;
using System.Configuration;
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;
 
namespace SmartLearner
{
    public class CCommonDB: CSql  {public CCommonDB() : base() { }    
        public string AuthenticateUser(      
            System.Web.SessionState.HttpSessionState objSession, // Session Variable      
            System.Web.HttpResponse objResponse,                 // Response Variable      
            string email,                                        // Login      
            string password,                                     // Password      
            bool bPersist                                        // Persist login      
            )    
        {      
            int nLoginID  = 0;      
            int nLoginType  = 0;      // Log the user in      
            Login(email, password, ref nLoginID, ref nLoginType);      
            if(nLoginID != 0)  // Success      
            {        // Log the user in        
                System.Web.Security.FormsAuthentication.SetAuthCookie(nLoginID.ToString(), bPersist);        
                // Set the session varaibles            
                objSession["loginID"]  = nLoginID.ToString();        
                objSession["loginType"] = nLoginType.ToString();        
                // Set cookie information incase they made it persistant        
                System.Web.HttpCookie wrapperCookie = new System.Web.HttpCookie("wrapper");        
                wrapperCookie.Value = objSession["wrapper"].ToString();        
                wrapperCookie.Expires = DateTime.Now.AddDays(30);              
                System.Web.HttpCookie lgnTypeCookie = new System.Web.HttpCookie("loginType");        
                lgnTypeCookie.Value = objSession["loginType"].ToString();        
                lgnTypeCookie.Expires = DateTime.Now.AddDays(30);        
                // Add the cookie to the response        
                objResponse.Cookies.Add(wrapperCookie);        
                objResponse.Cookies.Add(lgnTypeCookie);        
                return "/default.aspx";          
            }          
            case 1:  // Admin Login          
            {            
                return "/Admin.aspx";          
            }          
            case 2:  // Staff Login          
            {            
                return "/Staff.aspx";          
            }          
            default:          
            {            
                return string.Empty;          
            }        
        }      
    }      
    else      
{        
    return string.Empty;      
}    
}    
/// <summary>    
/// Verifies the login and password that were given    
/// </summary>    
/// <param name="email">the login</param>    
/// <param name="password">the password</param>    
/// <param name="nLoginID">returns the login id</param>    
/// <param name="nLoginType">returns the login type</param>    
 
    public void Login(string email, string password, ref int nLoginID, ref int nLoginType)    
{      ResetSql();      
DataSet ds = new DataSet();      
// Set our parameters      
SqlParameter paramLogin = new 
SqlParameter("@username", SqlDbType.VarChar, 100);      paramLogin.Value = email;      SqlParameter paramPassword = new SqlParameter("@password", SqlDbType.VarChar, 20);      paramPassword.Value = password;      
 
Command.CommandType = CommandType.StoredProcedure;      
Command.CommandText = "glbl_Login";      
Command.Parameters.Add(paramLogin);      
Command.Parameters.Add(paramPassword);      
 
Adapter.TableMappings.Add("Table", "Login");      
Adapter.SelectCommand = Command;      
Adapter.Fill(ds);      
if(ds.Tables.Count != 0)      
{        
    DataRow row = ds.Tables[0].Rows[0];        
// Get the login id and the login type        
nLoginID  = Convert.ToInt32(row["Login_ID"].ToString());        
nLoginType  = Convert.ToInt32(row["Login_Type"].ToString());      
}      
else      
{        
nLoginID = 0;        
nLoginType = 0;      
}    
}  
}
}
abstract public class CSql  
{    
private SqlConnection sqlConnection;      // Connection string    
private SqlCommand sqlCommand;          // Command    
private SqlDataAdapter sqlDataAdapter;      // Data Adapter          
private DataSet sqlDataSet;            // Data Set    
public CSql()    
{      
sqlConnection  = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);      
sqlCommand    = new SqlCommand();      
sqlDataAdapter  = new SqlDataAdapter();      
sqlDataSet    = new DataSet();      
sqlCommand.Connection = sqlConnection;    
}    
/// <summary>    
/// Access to our sql command    
/// </summary>    
protected SqlCommand Command    
{      
    get { return sqlCommand; }    }    
/// <summary>    
/// Access to our data adapter    
/// </summary>    
protected SqlDataAdapter Adapter    
{      
    get { return sqlDataAdapter; }    }    
/// <summary>    
/// Makes sure that everything is clear and ready for a new query    
/// </summary>    
 
protected void ResetSql()    
{      
    if(sqlCommand != null)      
{        sqlCommand = new SqlCommand();        
sqlCommand.Connection = sqlConnection;      
}      
    if(sqlDataAdapter != null)        
sqlDataAdapter = new SqlDataAdapter();      
if(sqlDataSet != null)        
sqlDataSet = new DataSet();    }    
 
/// <summary>    
/// Runs our command and returns the dataset    
/// </summary>    
/// <returns>the data set</returns>    
protected DataSet RunQuery()    
{      
sqlDataAdapter.SelectCommand = Command;      
sqlConnection.Open();      
sqlConnection.Close();      
sqlDataAdapter.Fill(sqlDataSet);      
return sqlDataSet;    }  
}
}
                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-19 at 15:44:50ID24666608
Tags

C#

Topics

Programming for ASP.NET

,

Microsoft Visual C#.Net

Participating Experts
1
Points
500
Comments
8

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Compile a large ASP.net app without Visual Studio
    Hi Folks, I created a pretty large ASP.net application (based on IBuySpy portal but with a huge amount of variations) using Visual Studio. During deployment to another computer (without Visual Studio, just .net runtime installed) it occurs that compilation on this machine i...
  2. Is there a trial version of visual studio professional?
    Is there a trial version of visual studio professional that i can download somewhere?
  3. Visual Studio
    I am running a ASP.Net application on a Windows 2003 Server. I am using Visual Studio to design the app. When I go to add connection to my database using a DSN ( from my client PC) as the rest of the application is using it only lists the DSNs set up on my local machine an...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: guru_samiPosted on 2009-08-19 at 16:12:41ID: 25138212

If you login successfully you will be returned to Default.aspx due to this statemente:
--> return "/default.aspx";

And you won't even reach other statements even if they are syntactically correct.

What is LoginID / what is LoginType??

So I think you want to redirect user to specific page depending on theLoginTtype right?
If yes... try the code below:

string url = String.Empty;
if(nLoginID != 0)  // Success      
            {        // Log the user in        
                System.Web.Security.FormsAuthentication.SetAuthCookie(nLoginID.ToString(), bPersist);        
                // Set the session varaibles            
                objSession["loginID"]  = nLoginID.ToString();        
                objSession["loginType"] = nLoginType.ToString();        
                // Set cookie information incase they made it persistant        
                System.Web.HttpCookie wrapperCookie = new System.Web.HttpCookie("wrapper");        
                wrapperCookie.Value = objSession["wrapper"].ToString();        
                wrapperCookie.Expires = DateTime.Now.AddDays(30);              
                System.Web.HttpCookie lgnTypeCookie = new System.Web.HttpCookie("loginType");        
                lgnTypeCookie.Value = objSession["loginType"].ToString();        
                lgnTypeCookie.Expires = DateTime.Now.AddDays(30);        
                // Add the cookie to the response        
                objResponse.Cookies.Add(wrapperCookie);        
                objResponse.Cookies.Add(lgnTypeCookie);        
   
           // If you are refering 1,2, for LoginID replace it in switch
           switch(LoginType)
          {
               case 1:  // Admin Login                            
                     url = "/Admin.aspx";
                     break;          
                   
            case 2:  // Staff Login                          
                url = "/Staff.aspx";          
                 break;
                     
            default:                              
                 url = "/default.aspx";      
                break;    
           } //end switch            
 
            } //end if

return url;      
           
Set break points within the code and note whats happening on while you debug...

 

by: haramsdePosted on 2009-08-20 at 12:28:27ID: 25146138

Hi guru_sami

Thank you for your help so far. My errors have decreased considerably. Please could you help with the Csql class and Login method? My dataset is called HRdataset and my tableadapter is called Account_UserTableAdapter. I'm not quite sure how to reference them in the code? I've attached what I believe is true but could do with some help please.

Thank you/

This is the updated code:
 
using System;
using System.Data;
using System.Configuration;
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;
 
namespace SmartLearner
{
    public class CCommonDB: CSql  {public CCommonDB() : base() { }    
        public string AuthenticateUser(      
            System.Web.SessionState.HttpSessionState objSession, // Session Variable      
            System.Web.HttpResponse objResponse,                 // Response Variable      
            string email,                                        // Login      
            string password,                                     // Password      
            bool bPersist                                        // Persist login      
            )    
        {      
            string url = String.Empty;
if(nLoginID != 0)  // Success      
            {        // Log the user in        
                System.Web.Security.FormsAuthentication.SetAuthCookie(nLoginID.ToString(), bPersist);        
                // Set the session varaibles            
                objSession["loginID"]  = nLoginID.ToString();        
                objSession["loginType"] = nLoginType.ToString();        
                // Set cookie information incase they made it persistant        
                System.Web.HttpCookie wrapperCookie = new System.Web.HttpCookie("wrapper");        
                wrapperCookie.Value = objSession["wrapper"].ToString();        
                wrapperCookie.Expires = DateTime.Now.AddDays(30);              
                System.Web.HttpCookie lgnTypeCookie = new System.Web.HttpCookie("loginType");        
                lgnTypeCookie.Value = objSession["loginType"].ToString();        
                lgnTypeCookie.Expires = DateTime.Now.AddDays(30);        
                // Add the cookie to the response        
                objResponse.Cookies.Add(wrapperCookie);        
                objResponse.Cookies.Add(lgnTypeCookie);        
    
           // If you are refering 1,2, for LoginID replace it in switch
           switch(LoginType)
          {
               case 1:  // Admin Login                            
                     url = "/Admin.aspx";
                     break;          
                    
            case 2:  // Staff Login                           
                url = "/Staff.aspx";          
                 break;
                      
            default:                              
                 url = "/Login.aspx";      
                break;     
           } //end switch            
  
            } //end if
 
return url;      
}    
}    
/// <summary>    
/// Verifies the login and password that were given    
/// </summary>    
/// <param name="email">the login</param>    
/// <param name="password">the password</param>    
/// <param name="nLoginID">returns the login id</param>    
/// <param name="nLoginType">returns the login type</param>    
 
    public void Login(string email, string password, ref int nLoginID, ref int nLoginType)    
{      ResetSql();      
DataSet ds = new HRdataSet.xsd;      
// Set our parameters      
SqlParameter paramLogin = new 
SqlParameter("@username", SqlDbType.VarChar, 100);      
paramLogin.Value = email;      
SqlParameter paramPassword = new SqlParameter("@password", SqlDbType.VarChar, 20);      
paramPassword.Value = password;      
 
Command.CommandType = CommandType.StoredProcedure;      
Command.CommandText = "glbl_Login";      
Command.Parameters.Add(paramLogin);      
Command.Parameters.Add(paramPassword);      
 
Adapter.TableMappings.Add("Table", "Login");      
Adapter.SelectCommand = Command;      
Adapter.Fill(ds);      
if(ds.Tables.Count != 0)      
{        
    DataRow row = ds.Tables[0].Rows[0];        
// Get the login id and the login type        
nLoginID  = Convert.ToInt32(row["nLoginID"].ToString());        
nLoginType  = Convert.ToInt32(row["LoginType"].ToString());      
}      
else      
{        
nLoginID = 0;        
nLoginType = 0;      
} 
)  
}
}
abstract public class CSql  
{    
private SqlConnection sqlConnection;      // Connection string    
private SqlCommand sqlCommand;          // Command    
private SqlDataAdapter Account_UserTableAdapter;      // Data Adapter          
private DataSet HRdataSet;            // Data Set    
public CSql()    
{      
sqlConnection  = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);      
sqlCommand    = new SqlCommand();      
sqlDataAdapter  = new Account_UserTableAdapter();      
sqlDataSet    = new HRdataSet();      
sqlCommand.Connection = sqlConnection;    
}    
/// <summary>    
/// Access to our sql command    
/// </summary>    
protected SqlCommand Command    
{      
    get { return sqlCommand; }    }    
/// <summary>    
/// Access to our data adapter    
/// </summary>    
protected SqlDataAdapter Account_UserTableAdapter    
{      
    get { return sqlDataAdapter; }    }    
/// <summary>    
/// Makes sure that everything is clear and ready for a new query    
/// </summary>    
 
protected void ResetSql()    
{      
    if(sqlCommand != null)      
{        sqlCommand = new SqlCommand();        
sqlCommand.Connection = sqlConnection;      
}      
    if(sqlDataAdapter != null)        
sqlDataAdapter = new SqlDataAdapter();      
if(sqlDataSet != null)        
sqlDataSet = new DataSet();    }    
 
/// <summary>    
/// Runs our command and returns the dataset    
/// </summary>    
/// <returns>the data set</returns>    
protected DataSet RunQuery()    
{      
sqlDataAdapter.SelectCommand = Command;      
sqlConnection.Open();      
sqlConnection.Close();      
sqlDataAdapter.Fill(sqlDataSet);      
return sqlDataSet;    }  
}
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:

Select allOpen in new window

 

by: haramsdePosted on 2009-08-20 at 12:33:11ID: 25146175

FYI - This is my table:
CREATE TABLE [dbo].[Account_User](
      [LoginId] [int] IDENTITY(1,1) NOT NULL,
      [Username] [varchar](30) COLLATE Latin1_General_CI_AS NOT NULL,
      [Password] [varchar](15) COLLATE Latin1_General_CI_AS NOT NULL,
      [LoginType] [tinyint] NOT NULL,
 CONSTRAINT [PK_Account_User] PRIMARY KEY CLUSTERED
(
      [AccountUserId] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

 

by: guru_samiPosted on 2009-08-20 at 15:12:17ID: 25147624

Ok I see you are using some abstract CSql class that gets you some DB related object....
It don't know what resetSql is trying to do ?

Ok I see a Command Property in your base CSql class but don't see a Adapter property that you are using in derived Class...

Is that abstract class used somewhere else....i.e. any other class derived from it....to know CSql is properly designed and tested...

 

by: haramsdePosted on 2009-08-20 at 16:29:48ID: 25148002

Hi guru sami

To be honest, I'm not sure of the complete purpose of the resetSql method. I'm trying to adapt code I found on a webpage (http://forums.asp.net/p/1146069/2423716.aspx) to suit my website. I'm really new to this and was just trying to get it working!

I really appreciate your help so far. Thank you. :-)

 

by: haramsdePosted on 2009-08-20 at 16:31:41ID: 25148006

Plus, I'm using n-tier architecture so the use of the datasets in the code was really appealing!

 

by: guru_samiPosted on 2009-08-20 at 16:47:59ID: 25148087

OhO you went way too far....
If you don't mind not using what you have right now and can go with other approaches...check this one first:
http://www.codedigest.com/Articles/ASPNET/112_Implementing_Forms_Authentication_in_ASPNet_20.aspx

Then look at the following videos they are great to start learning on setting up login mechanism:
http://www.asp.net/learn/security-videos/

FormsAuthentication and asp.net Membership/Roles provider will make your coding easy and efficient.

 

by: haramsdePosted on 2009-08-22 at 11:21:33ID: 31617926

Fantastic, thank you for your help. :-)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...