How use UrlHelper in signalR HubClass

前端 未结 2 870
执念已碎
执念已碎 2021-01-18 10:09

I have a Chat class drived from Hub. I want to know if thers a way to built URL by URLHelper like : Url.Action(\"action\",\"Controller\").

as i can derived the cla

2条回答
  •  無奈伤痛
    2021-01-18 10:43

    You can do it with this, and I am using T4MVC.

    var urlHelper = new UrlHelper(Context.Request.GetHttpContext().Request.RequestContext);
    var url = urlHelper.Action(MVC.Directors.EventSchedule.Index(EventId));
    

提交回复
热议问题