检测移动设备是否有 http post 请求
如果 http post 请求是以编程方式完成的,有没有办法知道移动设备。 例如,在我的 android 上,我正在执行以下操作:
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("login", "12312"));
nameValuePairs.add(new BasicNameValuePair("password", "234"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
有没有办法知道发送此请求的是 android 设备?我了解我可以在此处发送附加数据来识别设备。问题是:如果 post 请求是以这种方式完成的,是否有一种方法可以理解它是从 andriod 设备完成的(例如通过使用 UserAgent)?
接受请求的服务器是用asp.net mvc编写的。
Is there a way to know mobile device if http post request was done programmatically.
E.g. on my android Im doing the following thing:
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("login", "12312"));
nameValuePairs.add(new BasicNameValuePair("password", "234"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
Is there a way to know that it was a andriod device that sent this request? I understand I can send additional data here to identify the device. The question is: if post request was done this way is there a way to understand that it was done from andriod device (like by using UserAgent)?
Server that accepts the requests is written in asp.net mvc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用“User-Agent”HTTP 标头,但它可能会被欺骗或根本不设置,尽管所有现代浏览器都实现了此标头。一些有用的信息可以在 Wiki 上找到
Use "User-Agent" HTTP header, however it can be spoofed or not set at all, although all modern browser implement this header. Some useful info can be found on Wiki