简体   繁体   中英

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?

I'm guessing that the context does not know anything about the html but only the request, right?

If you lookup MSDN HttpContextBase you'll get a pretty good answer:

HttpContextBase Class

Serves as the base class for classes that contain HTTP-specific information about an individual HTTP request.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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