CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.security Tags:
Item Type: NewsGroup Date Entered: 2/28/2008 1:44:56 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 18 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
roma123
Asp.Net User
login page in this code its check if statement (i bold that part) but i cant able get inside if statement so please help me2/28/2008 1:44:56 AM

0/0

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 System.Data.SqlClient;

using System.Data.SqlTypes;

public partial class Login : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

 

protected void Login1_Authenticate1(object sender, AuthenticateEventArgs e)

{

bool Authenticated = false;

Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);

e.Authenticated = Authenticated;

if (Authenticated == true)

{

Response.Redirect(
"website6/Home.aspx");

}

}

private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)

{

bool boolReturnValue = false;

// Insert code that implements a site-specific custom

// authentication method here.

// This example implementation always returns false.

string strConnection = "Server=.;Initial Catalog=Doctors;Integrated Security=True";

SqlConnection Connection = new SqlConnection(strConnection);

String strSQL = "Select username,password From users";

SqlCommand command = new SqlCommand(strSQL, Connection);

SqlDataReader Dr;

Connection.Open();

Dr = command.ExecuteReader();

while (Dr.Read())

{

if ((UserName == Dr["username"].ToString()) & (Password == Dr["Password"].ToString()))

{

boolReturnValue =
true;

}

Dr.Close();

return boolReturnValue;

}

rojay12
Asp.Net User
Re: login page in this code its check if statement (i bold that part) but i cant able get inside if statement so please help me2/28/2008 2:00:57 AM

0/0

Shouldn't it be? 

if ((UserName == Dr["username"].ToString()) && (Password == Dr["Password"].ToString()))

{

boolReturnValue =
true;

}


Jared Roberts
Lead Application Developer
rojay12
Asp.Net User
Re: login page in this code its check if statement (i bold that part) but i cant able get inside if statement so please help me2/28/2008 2:08:21 AM

0/0

and why not do this...

 

    private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
    {
        bool boolReturnValue = false;
        string strConnection = "Server=.;Initial Catalog=Doctors;Integrated Security=True";
        SqlConnection Connection = new SqlConnection(strConnection);
        String strSQL = "Select username,password From users Where UserName=@Username and Cast(Password as binary)=Cast(@Password as binary)";
        SqlCommand command = new SqlCommand(strSQL, Connection);
        command.Parameters.Add("@UserName", SqlDbType.VarChar).value = UserName;
        command.Parameters.Add("@Password ", SqlDbType.VarChar).value = Password;
        SqlDataReader Dr;
        Connection.Open();
        Dr = command.ExecuteReader();
        if (Dr.HasRows()){
             boolReturnValue = true;
        }
        Dr.Close();
        Dr.Dispose();
        return boolReturnValue
    }
 
Jared Roberts
Lead Application Developer
venkatesham05
Asp.Net User
Re: login page in this code its check if statement (i bold that part) but i cant able get inside if statement so please help me2/28/2008 5:33:28 AM

0/0

how can i write the authentication mode in web.config file,

please reply me

XiaoYong Dai –
Asp.Net User
Re: login page in this code its check if statement (i bold that part) but i cant able get inside if statement so please help me2/29/2008 12:20:14 PM

0/0

venkatesham05:

how can i write the authentication mode in web.config file,

please reply me

Hi venkatesham05

I guess you mean the authentication section in web.config, for example

 <authentication mode="Forms"/>


Best Regards
XiaoYong Dai
Microsoft Online Community Support

Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
PLAYLIST NOT SHOWING OR PLAYING | LongTail Video | Home of the JW ... Post your player code or a link to your test page so someone can help you. ..... be to print $current_dir and see if the if statement if($current_dir ! ...
Ain't It Cool News: The best in movie, TV, DVD, and comic book news. Dont want to read more b- but I cant help it...Roll on opening day! ...... If this game is going so far as to bury messages INSIDE source code, then dammit, ...
Digg - iPhone dev team disputes Apple FUD with bold statement ... Sounds like a pretty matter of fact and realistic statement to me. ..... Apple lost that sale.. th iphone is just a fancy phone if we cant ad our own apps ...
Case Of The Mischievous Minotaur - Part XII Jul 26, 2005 ... I asked, noticing that Slinkpips didn't finish his statement. .... Ok so he needed help with the cheat codes hmmmmm im still going= with ...
CodeProject: Web Development Discussion Boards. Free source code ... so please can you provide help about how to do it. or if there is any other ... Can someone tell me what I'm doing wrong? The CSS statement is called in the ...
Jim O’Halloran’s Weblog» Blog Archive » Building a Complete ... Oct 24, 2007 ... If we use the above fragment of PHP code to construct the SQL statement, it becomes trivially easy to bypass the login page. So what do we ...
AJAX Login System using XMLHttpRequest | evolt.org Anyway, where your login system screwed me was that if i clicked another link .... "if (!$result)" statement, but fails on the next one (straight after the ...
New Drupal theming ebook | 11 heavens You get of course the $node if the drupal internal path is node/x. You get this extra bit ..... Hi, i registered, but i cannot log in. Can YOu help me? ...
Contacting a contact list: A tutorial - Torrential Web Dev I can't able to get libgmailer.php. plz send a correct code for this .... Just contact them and check or if they offer a phpinfo page there should be a ...
PHP :: HTML Web Page Hyperlink To Php Web Page But, if I want to embed some PHP code in this page, I must rename it to INDEX. .... symbols which needs some repair like above so please give me a list of ...




Search This Site:










email

is it possible to automate duplication of security role permissions

<@ master> does not have a theme attribute?

feedback/wishlist forum?

asp.net search page - how to use multiple search terms???

menu

drop down selected item value question

modify values in clientside javascript and retreive in code-behind?

renaming a user control in a subfolder

treeview file directory tutorial??

please help: only get codebehind not graphics on portalvbvs

how to check if a session variable exists. if (session["loggedin"])

how to get login to show on home page.

this forum has reached 25k threads & 1000 pages

modifying the menu bar with solpart menu designer

<br /> versus margin-bottom

quick question - allow a security role to upload (how)

can't add users with a scheduler task

value cannot be null. parameter name: type

multiple step createuserwizard creates user after 1st step

uploadfileasync

accesslockfiles not being removed

domain and user group authorization

onitemcommand trigger automatically when a page refresh

dataviews and datatables

data table empty

string formatting.

encript password in dotnetnuke 2.1.2

casting as a mailmessage

does anyboy how .net 2.0 load user store profile when calling protecteddata.unprotect()

 
All Times Are GMT