Controller
public class AuthController : ApiController {
public HttpResponseMessage Post(string email, string userName, string password) {
return new HttpResponseMessage(HttpStatusCode.OK);
}
}
/****** Object: Table [dbo].[PaymentActions] Script Date: 10/14/2011 11:53:56 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
CREATE TABLE [dbo].[PaymentActions]( | |
[PaymentActionID] [uniqueidentifier] NOT NULL, | |
[PaymentID] [uniqueidentifier] NOT NULL, |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="lowerCaseForce" stopProcessing="true"> | |
<match url="[A-Z]" ignoreCase="false" /> | |
<action type="Redirect" url="{ToLower:{URL}}" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> |
[TestMethod] | |
public void ConnegTest() | |
{ | |
var selector = new FormatterSelector(); | |
var response = new HttpResponseMessage(); | |
response.RequestMessage = new HttpRequestMessage(); | |
var headers = response.RequestMessage.Headers; | |
headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain")); | |
headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json",0.8)); |
public class ThroughputMessageHandler : DelegatingHandler | |
{ | |
private readonly ILogger _logger; | |
private Timer _timer; | |
private int _count; | |
public ThroughputMessageHandler(ILogger logger) | |
{ | |
_logger = logger; | |
_count = 0; | |
_timer = new Timer(new TimerCallback(timerCallback),null,1000,1000); |
typeof (Convert) | |
.GetMethods(BindingFlags.Static|BindingFlags.Public) | |
.Where(m=>m.Name.StartsWith("To")) | |
.Select(m=>m.GetParameters().First().ParameterType) | |
.Distinct() |
paul@jupiter:~/GitHub/SignalR% wc -l **/*.cs | grep 'total' | |
13141 total | |
paul@jupiter:~/GitHub/SignalR% wc -l **/*.js | grep 'total' | |
94225 total |
public class CustomFilterProvider : IFilterProvider { | |
public IEnumerable<Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) { | |
yield return new Filter( | |
new SecondaryLoggingFilterAttribute(), FilterScope.Controller, null | |
); | |
} | |
} |
// From http://msdn.microsoft.com/en-us/magazine/cc163467.aspx | |
internal class AsyncResult : IAsyncResult | |
{ | |
// Fields set at construction which never change while | |
// operation is pending | |
readonly AsyncCallback m_AsyncCallback; | |
readonly Object m_AsyncState; | |
// Fields set at construction which do change after | |
// operation completes |
public class ValidateModelStateAttribute : ActionFilterAttribute { | |
public override void OnActionExecuting(HttpActionContext actionContext) { | |
var modelState = actionContext.ModelState; | |
if (!modelState.IsValid) { | |
var errors = modelState.Keys | |
.Where(key => modelState[key].Errors.Any()) |
Controller
public class AuthController : ApiController {
public HttpResponseMessage Post(string email, string userName, string password) {
return new HttpResponseMessage(HttpStatusCode.OK);
}
}