I have a scenario that I have a windows forms application that is using SignalR and a website. The client app is authenticated on the website using FormsAuthentication and the calls a Hubmethod with the [Authorize] attribute. Everything works find when I
debug both application on same machines. Once I deploy website on one server and win app on another machine hub methods with authorized attribute do not work.
pantonis
Member
332 Points
265 Posts
SignalR authorization problem
Dec 14, 2012 02:58 PM|LINK
Hi,
I have a scenario that I have a windows forms application that is using SignalR and a website. The client app is authenticated on the website using FormsAuthentication and the calls a Hubmethod with the [Authorize] attribute. Everything works find when I debug both application on same machines. Once I deploy website on one server and win app on another machine hub methods with authorized attribute do not work.
Why is this happening. Is there any bug on this?
Please mark this post as answer if it helped you solve your problem
DamianEdward...
Member
234 Points
37 Posts
Microsoft
Re: SignalR authorization problem
Dec 14, 2012 03:47 PM|LINK
Can you try looking at the HTTP requests to see what cookies are/aren't being passed? Also, what you're client code looks like.
Senior Program Manager, ASP.NET
Microsoft
pantonis
Member
332 Points
265 Posts
Re: SignalR authorization problem
Dec 17, 2012 06:24 AM|LINK
My code is the following.
void Connect(Cookie authCookie) { string str = "Test"; double Val = 1000; HubConnection hubConn = new HubConnection("http://10.10.10.10"); CookieContainer cookieCont = new CookieContainer(); hubConn.CookieContainer = cookieCont; hubConn.CookieContainer.Add(authCookie); IHubProxy Proxy = hubConn.CreateHubProxy("myHub"); hubConn.Start().Start(); Proxy.Invoke("getTheStuff", new JavaScriptSerializer().Serialize(new CustomModel() { Name = str, Value = Val })); }The Hub
Please mark this post as answer if it helped you solve your problem
DamianEdward...
Member
234 Points
37 Posts
Microsoft
Re: SignalR authorization problem
Jan 17, 2013 07:35 PM|LINK
Your code has a few issues:
Can you please take a look at the sample at https://github.com/davidfowl/MessengR
This shows a WPF client talking to an ASP.NET app using Forms auth and SignalR.
Senior Program Manager, ASP.NET
Microsoft
pantonis
Member
332 Points
265 Posts
Re: SignalR authorization problem
Jan 18, 2013 06:54 AM|LINK
Sorry for this (syntax error)
Serialization/Deserialization as you described it works only on my pc. When I take this on production server it does not work.
Please mark this post as answer if it helped you solve your problem
davidfowl
Contributor
2766 Points
624 Posts
Microsoft
Re: SignalR authorization problem
Jan 19, 2013 05:43 PM|LINK
When you say "it doesn't work on your production server". What exactly do you mean? What specific error message are you getting?
Senior SDE, ASP.NET Team, Microsoft
pantonis
Member
332 Points
265 Posts
Re: SignalR authorization problem
Jan 20, 2013 07:17 AM|LINK
It does not return any error. When the signalr sends the object, the event on the other end which is subscribed to listen simply does not get fired
Please mark this post as answer if it helped you solve your problem