*OVERVIEW*
This project is to be written as a C# MVC4 Web Application. The guts of the code will be an action filter that will log requests made to an API. The api can be a dummy controller with a dummy action that returns “Hello world”. I’ll be porting your tracking code to my own API so the dummy api doesn’t matter too much.
*IN MEMORY CACHING (DON’T WRITE TO DB EVERY REQUEST)*
Using [login to view URL], requests will be logged in memory for N times before being bulk inserted into a MSSQL table. N will be defined in the app settings as ApiTrackingWriteInterval. The memory cache should also attempt to bulk insert on application stop or application error.
*WHAT TO LOG?*
This API expects an HTTP header called “Authentication” of the form USER:SIGNATURE. The user portion of this header is to be logged along with the full URL path, the URL query string, and a timestamp. Finally, log the name of the server handling the request as well.
So for an example request of http://localhost/myapi/?q=someQuery, with an HTTP header called Authentication with the value MyUser:kdiekdikcid= you would log
- “MyUser”
- A Timestamp
- myapi
- q=someQuery
- machine name
all in separate fields. The table you bulk insert into will be called Api_Requests and contain columns named [User], [Timestamp], [Path], [Query], [Machine_Name].
The connection string should be in the AppSettings (I know there is a connection strings block. I prefer it all in app settings) with the name cnstr_apitracking.
*A ‘FILTER BY DOMAIN’ OPTION*
Also, this code should take into account a CSV of domains to NOT log. This csv will be stored in the app settings under ApiTrackingIgnoreDomains. So for example if the app settings contained the value “localhost,[login to view URL]”, then the tracking code should ignore requests from http://localhost or [login to view URL] but still log requests for http://www.mydomain.com.
*RECAP OF APPSETTINGS*
Just to be clear, all the settings for this project are:
- ApiTrackingWriteInterval - how frequently the memory cache is written to the DB
- cnstr_apitracking - the tracking DB connection string
- ApiTrackingIgnoreDomains - a CSV of domains to NOT log
*THE TRACKING TESTER APP*
Since the API will need to track the user name from a special HTTP header (see “What to log?” above), this project can’t be tested with a browser. Instead you’ll need to make a console application that does an HTTP request and also inserts the Authentication HTTP header into the request. I will then use this app to verify your work. Have the value for “user” in the app settings. You can put anything in for the signature that comes after the semicolon.
*EXPECTATIONS*
I try not to get hung up on every detail when writing a spec. I’d rather rely on your best judgement.
That being the case, once I get your work back I will almost certainly ask for something to be changed or added outside of my original spec. I don’t expect this scope creep to be free, so don’t worry. But you should be aware that my project management style is to work with many small projects rather than a single enormous bid for a month’s worth of work.
*CODING STANDARDS*
I need to be able to read the code that you provide. Code in the manner you prefer provided that you:
- Use verbose naming. When in doubt, be more verbose rather than less. The exception would be loops. foreach (var vObj in verboselyNamedObjectList) is ok.
- Use of classes and methods appropriately. Break up your code when you need to. I’m a believer that if you break your code up into verbosely named methods then your code is self documenting code (or at least pretty close).
I won’t flip out over capitalizations, file management, or any other minutia that some might care about. If your are an effective programmer, then you must be doing it right.
Hi Sir, i have 4 years of experience with ASP.NET and for the last 1.5 year i am working in ASP.NET MVC. Going through the requirements you specified, i feel i may be right person to do this job. Please see PM for details.