How to encrypt/decrypt the url in C#

后端 未结 4 1815
借酒劲吻你
借酒劲吻你 2021-01-06 12:45

I have a URL www.site-address/site-page/page1.aspx?username=deepu&password=deepu how can i change the URL to www.site-address/site-page/page1.aspx?username=232322323232&

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-06 13:25

    Your approach is flawed and encrypting will not really help the underlying problem. If you go out across the 'net you will rarely (should never) see a pattern like what you are describing, even if it is encrypted.

    Instead you should store the user credentials as securely as possible on the server and pass a unique, short-lived session token in the querystring that you can use to look up the credentials.

    As for storing securely on the server, once you've receive the user's password the first time, you should use a one-way hash, like SHA256, with a salt. You can pass this value wherever, store it, and to validate compare the has of a potential password to the hash you have stored. Treat a user's password like toxic waste - throw it away as quickly as possible. You want to be in the password storing business about as badly as you want to be in the toxic waste storing business.

    (Answered from my iPhone, links forthcoming or if someone wants to help me out! :))

提交回复
热议问题