2 Replies - 854 Views - Last Post: 15 January 2013 - 09:40 AM Rate Topic: -----

#1 curioussaggi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 08-January 13

how to call authenticate function having encrypted password

Posted 14 January 2013 - 08:20 AM

i am using a dll which has function of authentication that i have to use .following is the code:

 public DataSet Authenticate(string UserName, string Password)
 {
   DataSet ds = db.ExecuteDataSet("spAuthenticate", new object[] { UserName.ToLower().Trim(),EncryptText(Password)});
            return ds;
   }



i have taken two textboxes of "username" and "password" and a button "login"
nw i hve to call this function on login button click
i have made object of my class first
 protected void Bttnlogn_Click(object sender, EventArgs e)
        {
            athn.Authenticate(Txt_user.Text, Txt_pwd.Text);
             
            
            Response.Redirect("ViewInvoices.aspx");
        }





please tell me what more should i do because its not validating the password from the db.

Is This A Good Question/Topic? 0
  • +

Replies To: how to call authenticate function having encrypted password

#2 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5675
  • View blog
  • Posts: 12,192
  • Joined: 02-June 10

Re: how to call authenticate function having encrypted password

Posted 14 January 2013 - 10:21 AM

I doubt anyone here can help you with this since all the actual work is taking place inside some mysterious unnamed DLL that we know nothing about.

You need to follow the instructions provided to you by the maker of the DLL.

I will pointout that you don't seem to be taking any results back from the athn.Authenticate call. How do you know if it passed or failed? Could it be that method returns something like a boolean true if authentication passed, or false if the username and password don't match? I'm just guessing, but it makes sense.
Was This Post Helpful? 1
  • +
  • -

#3 h4nnib4l  Icon User is offline

  • The Noid
  • member icon

Reputation: 1182
  • View blog
  • Posts: 1,677
  • Joined: 24-August 11

Re: how to call authenticate function having encrypted password

Posted 15 January 2013 - 09:40 AM

As tlhIn`toq pointed out, you're not really using that Authenticate method. It returns a dataset, but you're calling it like a method with no return type. db.ExecuteDataSet returns a DataSet (at least I assume it does, because that's what your code says), and you return that DataSet from Authenticate, but those results don't ever *do* anything because you don't even assign them when you call the method. I would have expected to see DataSet ds = athn.Authenticate(Txt_user.Text, Txt_pwd.Text); in your event handler, not a method call with no variable to hold the results. Again, we have no clue what is actually happening because all of the action is happening in this .dll that we can't see, but I don't know why ExecuteDataSet would return a DataSet unless you're supposed to use that DataSet. Take tlhIn`toq's advice and look at the .dll's documentation. If there is none, then you could try using JetBrains' dotPeek to look inside the .dll and try to figure out the flow you need to be following.

And a side note: don't *do* things in your event handlers, place that logic in a separate method that you call from the event handler.

protected void MyEventHandler(object sender, EventArgs e)
{
    DoStuff();
}

private void DoStuff()
{
    ...
}


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1