【问题标题】:Get full path to site action within SignalR在 SignalR 中获取站点操作的完整路径
【发布时间】:2016-12-19 22:12:49
【问题描述】:

我想知道如何在我的 signalR 集线器中构建完整的操作路径。我的中心有代码:

public string GetUpdateUrl(string identifier)
{
     var helper = new System.Web.Mvc.UrlHelper(HttpContext.Current.Request.RequestContext);
     var result = String.Empty;
     try
     {
         result = helper.Action("Download", "Agent", identifier);                          
     }
     catch (Exception e)
     {
         var t = e;
     }
         return result;
 }

我想要的只是将完整的网址(例如 example.com/Conteroller/Action?identifier=some_code)返回给操作。

这里下载操作

 public ActionResult Download(string identifier)
 {
       //return download
 }

但我遇到了错误。

在这种情况下没有响应。

【问题讨论】:

  • 把它和你的标识符一起传递怎么样?
  • Response is not available in this context. 你的代码中没有Response 字.. 你错过了什么

标签: c# asp.net asp.net-mvc-4 signalr


【解决方案1】:

由于您的 SignalR 服务是由 owin 自托管的(不是吗?),您应该尝试检查 thisthis 的答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-10
    • 2017-03-16
    • 2014-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-11
    相关资源
    最近更新 更多