0

This is my GetFileData with return type FileResult so it should return a file:

public FileResult GetFileData(int fileId)
     {
         var file = db.Files.Single(x => x.Id == fileId);
         return File(file.Content, file.ContentType);
     }

but at last line, its showing red line on File and the error message is--the name file does not exist in current context. what should i do ??

duke
  • 1,816
  • 2
  • 18
  • 32

1 Answers1

1

First:

SignalR isn't for file transfer, it's for sending messages.

How can I transfer bytes in chunks to clients?

Second: File is not working because its declared in System.Web.Mvc.Controller, a SignalR hub doesn't extend this class. https://msdn.microsoft.com/en-us/library/system.web.mvc.controller(v=vs.118).aspx

A Hub extends Microsoft.AspNet.SignalR.Hub https://msdn.microsoft.com/en-us/library/microsoft.aspnet.signalr.hub(v=vs.118).aspx

Community
  • 1
  • 1
  • So, what should i do here if i have to return back file is there any work around? should i place this piece of code somewhere else. i have to make post comment system real time so, my code returns user pic back from db using this method.I was following this article http://techbrij.com/facebook-wall-posts-comments-knockout-aspnet-webapi any help most appreciated – duke Feb 04 '16 at 13:09