简体   繁体   English

从HttpContext获取图像数据?

[英]Get image data from HttpContext?

I think I already know the answer but I'd thought I give it a shot anyways. 我想我已经知道答案了,但是我还是想尝试一下。

Can I in MVC.NET get information from the html image tag (ie css class or data attibute) from the HttpContext? 我可以在MVC.NET中从HttpContext的html图像标签(即CSS类或数据属性)中获取信息吗?

I'm guessing that the context does not know anything about the html but only the request, right? 我猜想上下文不了解html,而只是请求,对不对?

If you lookup MSDN HttpContextBase you'll get a pretty good answer: 如果您查找MSDN HttpContextBase,您将得到一个很好的答案:

HttpContextBase Class HttpContextBase类

Serves as the base class for classes that contain HTTP-specific information about an individual HTTP request. 用作包含有关单个HTTP请求的HTTP特定信息的类的基类。

So yes you are right - you will only get information about the request sent to your server. 因此,是的,您是对的-您将仅获得有关发送到服务器的请求的信息。

I assume your client clicks on an image and that triggers a new request ? 我假设您的客户点击了图片并触发了新请求

If I am right you may add a clientSide script which writes the requested information in an hidden input field and submit a form - or you just pass the information as an url parameter to your server! 如果我是正确的,你可能会增加其在一个隐藏的输入字段 写入请求信息 的客户端脚本 ,并提交表单- 或者你只是传递 信息作为URL参数到您的服务器!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM