I am studying the following example of signalR
http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr-and-mvc-4
I want to implement it, and well the code is there, however I dont want the user to type the username in a prompt window, I am going to make the page available for logged in users, therefore I will have the context.User.
I would like to change the prompt part to use the context.User from the server side but I have no idea how.
thanks a lot
$('#displayname').val(prompt('Enter your name:', ''));
You could provide the information on page load or retrieve it via AJAX. I'd suggest the former.
Depending on your view engine, something like...
$('#displayname').val('@(Context.User.Replace("'", "\\'"))');
or Better, provide it as a property of your view model so it would be
$('#displayname').val('@(Model.User.Replace("'", "\\'"))');