简体   繁体   中英

Send image url to javascript from SignalR hub

I have images inside my Content folder and I want to send the path of them from a SignalR Hub to javascript function so the client can place it in an img src attribute and have it displayed. A signalR hub however doesn't have the Server object to get the web path to send. This is being done after the page has already been loaded. How can I get signalR to find the web path of the image?

您可以像这样从Context访问中心服务器:

 Context.Request.GetHttpContext().Server.MapPath("Content");

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