how to generate a unique token which expires after 24 hours?

前端 未结 5 436
既然无缘
既然无缘 2020-11-28 17:30

I have a WCF Webservice which checks if the user is valid.

If the user is valid I want to generate a token which expires after 24 hours.

public bool         


        
5条回答
  •  粉色の甜心
    2020-11-28 18:14

    This way a token will exist up-to 24 hours. here is the code to generate token which will valid up-to 24 Hours. this code we use but i did not compose it.

    public static string GenerateToken()
    {
        int month = DateTime.Now.Month;
        int day = DateTime.Now.Day;
        string token = ((day * 100 + month) * 700 + day * 13).ToString();
        return token;
    }
    

提交回复
热议问题