URL: Username with @

自闭症网瘾萝莉.ら 提交于 2019-11-26 03:09:59

问题


To send username and password with a URL, we use this scheme:

http://username:password@www.my_site.com

But my username is my_email@gmail.com.
The problem is the @.

How can I solve it?


回答1:


You need to URL encode the @ as %40.




回答2:


Use %40 in your username instead of the @ symbol for the url encoding. It should pass it properly then.




回答3:


Just do:

 http://my_email%40gmail.com:password@www.my_site.com

I am quite surprised that problem was with username @ and not the password -usually this is where I get reserved characters in url authority or path parts.

To solve general case of special characters: Just open chrome console with F12 then paste encodeURIComponent(str) where str is your password (or username) and then use the encoded result to form url with password.

Hope this saves you some time.



来源:https://stackoverflow.com/questions/10050877/url-username-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!