create web api for exposing login to .Net Website from Android App RRS feed

  • Question

  • Hello,

             I have created a ASP.Net Web forms Website in which forms authentication is done

                       FormsAuthenticationTicket tkt;
                        string cookiestr;
                        HttpCookie ck;
                        tkt = new FormsAuthenticationTicket(1, txtuserid.Text, DateTime.Now,
                  DateTime.Now.AddMinutes(30), false, "your custom data");
                        cookiestr = FormsAuthentication.Encrypt(tkt);
                        ck = new HttpCookie(FormsAuthentication.FormsCookieName, cookiestr);
                        //if (chkPersistCookie.Checked)
                        //    ck.Expires = tkt.Expiration;
                        ck.HttpOnly = true;
                        ck.Secure = true;
                        ck.Path = FormsAuthentication.FormsCookiePath;

    moreover - Salted MD5 is implemented for hashing the password with md5 and server side random number on ASPX and same process in ASPX.cs and checking the password for any tampering in server side. (every time a different hash of the password is transferred from client to server)

    Now I want to create a web api that is to be used by Android App for authentication into the website. How can I do it, Is there a some other way.


    Anoop Mathur

    Wednesday, March 4, 2020 5:11 AM

All replies

  • Hi anoop m,
    Based on your description,you can secure a web API using OAuth2 to authenticate against a membership database.
    Here are some related documents you can refer to.
    [Secure a Web API with Individual Accounts and Local Login in ASP.NET Web API 2.2]
    [ASP.NET Web API social authentication for Web and Mobile]
    [Build a REST API for your Mobile Apps with ASP.NET Core]
    Hope these are helpful for you.
    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
    Best Regards,
    Daniel Zhang

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 4, 2020 7:16 AM
  • https://forums.asp.net/

    WebAPI has a forum. In  ASP.NET forums

    Wednesday, March 4, 2020 10:44 AM