ユーザーがクリックして何かに入札できるボタンがあります。入札ごとに、最新の入札を他のすべてのクライアントにブロードキャストします。それが私がSignalRを使用している理由です。
ここで、ユーザーはアクティブなクレジットを持っている必要があります。クレジットがない場合は、どこかにリダイレクトしたいと思います。
より明白なアプローチは私を失敗させるので、どんな提案も歓迎します。
//Does the user have credits to spend?
if (user.LanceCreditBalance >= 1)
{
//populate the "ar" object and send it out to everybody.
var result = Json.Encode(ar);
Clients.addMessage(result);
}
else
{
//And this isn't working as expected. Doesn't redirect
//And causes a 302 error when viewing the Firebug console in Firefox.
HttpContext.Current.Response.Redirect(@"http://www.google.com");
}
上記のコードはすべて、SignalR.Hubクラスから継承するChatクラス内にあります。