Archive for May, 2014


BYOD – Bring Your Own Device
BYOT – Bring Your Own Technology
BYOP – Bring Your Own Phone
BYOPC – Bring Your Own PC

All of these refers to one terminology which means enabling employees / Students / Visitors to bring their owned mobile devices which ranges from a smart phone to laptops.

It was once when phones were only used for calling and messaging (SMS / MMS) and the data stored is local to that device. In today’s world technology is on its fast pace releasing newer gadgets, more updates and options with limitless possibilities. The digital era has made every individual bound to these devices and most of all the data which was once local to his device is now up in the cloud, which can be retrieved from any corner of the world. You are no more chained to additional capacities, storage, speed, etc and the fact is that your mobile could do almost all the things that your laptop or a desktop could do.

So, back to the original discussion, wouldn’t be wise for enterprises / organizations to give the liberty to individuals to use their own device, instead of providing them a dedicated PC / Laptop and the needed infrastructural setup? What do we gain here, lower IT overhead and freedom to employees! (remembering Eleanor Roosevelt, who said with great freedoms comes great responsibility.)

If you look at what are all the cons associated, the first thing that will hit your mind is “security”. But wouldn’t it be something challenging to tackle it? The experience gained by setting up something like this would be a case study for the future and will give rise to more innovation towards building mobile-enabled platforms, products and solutions.

“Method Not Found” in ASP.NET Web API when using PUT and DELETE Verbs

Now that you have deployed your REST API and you are receiving “Method Not Found” exception / 404 exceptions when using PUT and DELETE verbs, while GET and POST is working absolutely fine. The fix is simple and needs small changes within IIS.

Open “Internet Information Services (IIS) Manager”, select the corresponding application and double-click on the “Handler Mappings” as shown below:


Then select the “ExtensionlessUrlHandler-Integrated-4.0″ handler and double-click to edit this managed handler and click on “Request Restrictions…” button, as highlighted below:


In the “Verbs” tab, select “One of the following verbs:” option and type-in the following verbs, “GET, HEAD, POST, DEBUG, PUT, DELETE”. Note: By default the “All verbs” option is selected by default.


One final step is to ensure that your “web.config” contains “PUT” and “DELETE” in the verb attribute for “ExtensionlessUrl-Integrated-4.0” under the <handlers> section within <system.webServer>. Do a Find (Ctrl + F) if you have a really huge entries in “web.config” file.

    <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

You are good to go! As a practice I always perform a “Restart”, under “Manage Web Site” within the “Internet Information Services (IIS) Manager” window.

Categories: ASP.NET, C# Tags: , , , , , , ,

Uploading a File in ASP.Net Web API

Consider the following model file and a sample POST method.

namespace FeedbackService.Models
    public class Feedback
        public string Id { get; set; }
        public string EmailId { get; set; }
        public string Comment { get; set; }
        public string PageUrl { get; set; }
        public byte[] Attachment { get; set; }

The corresponding “Post” method is as given below.

        public HttpResponseMessage Post([FromBody] Feedback value)
                return ModelState.IsValid ? Request.CreateResponse(_wrapper.CreateFeedback(value) ? HttpStatusCode.Created : HttpStatusCode.InternalServerError, value) : Request.CreateResponse(HttpStatusCode.BadRequest, value);
            catch (Exception ex)
                return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);

In the above scenario, the file to be uploaded is converted to byte array first and then this request was posted from an html page. The first issue we encountered was “Maximum content length exceeded” and to troubleshoot this issue, we have to add the following entries in “web.config”

<!-- To be added under <system.web> -->
<httpRuntime targetFramework="4.5" maxRequestLength="1048576" executionTimeout="3600" />

<!-- To be added under <system.webServer> -->
<requestLimits maxAllowedContentLength="1073741824" />

The above said error went off, but there was new issue wherein the file upload was taking more time, That’s when we tried doing this the other way, we modified the “POST” method to include the following:

       public HttpResponseMessage Post()
            // Check if the request contains multipart/form-data.
            if (!Request.Content.IsMimeMultipartContent())
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);

                var httpRequest = HttpContext.Current.Request;

                // Check if any file(s) have been uploaded
                if (httpRequest.Files.Count > 0)
                    // Get file content as byte array
                    MemoryStream ms = new MemoryStream();
                    byte[] fileContent = ms.ToArray();

                    // Populate Feedback object
                    Feedback feedback = new Feedback();
                    feedback.PrototypeId = httpRequest.Form["prototypeId"];
                    feedback.PageUrl = httpRequest.Form["pageURL"];
                    feedback.EmailId = httpRequest.Form["emailId"];
                    feedback.Comment = httpRequest.Form["comment"];
                    feedback.Attachment = fileContent;

                    // Call the wrapper method
                    if (_wrapper.CreateFeedback(feedback))
                        return Request.CreateResponse(HttpStatusCode.Created);
                    return Request.CreateResponse(HttpStatusCode.BadRequest);

                // Return status indicating that the server refuses to fulfill request
                return Request.CreateResponse(HttpStatusCode.Forbidden);
            catch (Exception ex)
                return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);

and to test this, we created the following sample html file

<!DOCTYPE html>
<html xmlns="">
    <title>Feedback Test Form</title>
    <style type="text/css">
            table.bottomBorder {
                border-collapse: collapse;
            table.bottomBorder td, table.bottomBorder th {
                border-bottom: 1px dotted black;
                padding: 5px;
    <form enctype="multipart/form-data" method="post" action="http://localhost:62465/api/feedback" id="feedbackForm" novalidate="novalidate">
            <legend><b>Submit Feedback</b></legend>
            <table class="bottomBorder">
                    <td>Prototype ID:</td>
                    <td><input type="text" style="width: 320px; color: grey;" name="prototypeId" id="prototypeId" value="59938fe1-d80a-4534-8a7a-01977dab8370"></td>
                    <td>Page URL:</td>
                    <td><input type="text" style="width: 320px; color: grey;" name="pageURL" id="pageURL" value="http://localhost:62465/PostFeedback.html"></td>
                    <td>Email ID:</td>
                    <td><input type="text" style="width: 320px; color: grey;" name="emailId" id="emailId" value=""></td>
                    <td><textarea name="comment" style="width: 320px; color: grey;" cols="30" rows="4">This page is super awesome!</textarea></td>
                    <td>File Attachment:</td>
                    <td><input type="file" style="width: 320px; color: grey;" name="fileAttachment" id="fileAttachment"></td>
                <input type="submit" value="Submit Feedback" id="btnUpload">

The above is just a sample implementation of uploading a file in ASP.Net Web API as well as an example of sending HTML form data.

Categories: ASP.NET, C# Tags: , , , , , ,

Another Acquisition Kills a well-renowned product!

Oh yeah! I am referring it to “Taleo”, a “Human Resource Management System (HRMS/HRIS)” product, acquired by Oracle Corporation. Taleo Corporation on other hand had been a long time player on areas like recruitment, performance / compensation management, learning and development, but primarily you would see this in use for recruitment. Bigger firms and corporations like HP, Cognizant and other software companies use them.

From a job applicant’s perspective it was always easier to maintain one profile (resume) and use the Open ID when applying for jobs. You also have options to retrieve your profile in DOC, PDF formats and to mention these are good innovative ideas, but guess what all this wouldn’t stay for long. I had already seen Oracle posting a note saying that Taleo would be accessible only until June, 2014; and for existing Taleo users they can log on to and retrieve their profile in a format desired.

Building a product like this would have been greatest efforts of many developers and engineers and let’s wait to hear back from Oracle Corporation on what product offering they would bring in future on the same platform? Do you think they would? Oh yes! Thinking as a physicist, energy transformation is the process of changing one form of energy to another. Hence sunset of this would be a new beginning of another!

Adieu “Windows XP”

May 21, 2014 1 comment

I still remember the first glance of “Windows XP” which gave a completely new dimensions towards how easy it was to use a Windows Operating System. Dusting old memories, it was sometime in 2012 when my father agreed to buy me a personal computer, it was P4 system with 2 GB RAM and a DVD drive with an addition of a TV Tuner card. This was a pre-configured system from a branded manufacturer “HCL” and this model was called as “Busy Bee” and came with the bundled operating system “Windows XP Home Edition”.

Back those days Windows 98 SE was still widely used and considered to be the best. But Windows XP ran like a champ and gave such a positive vibe and impressions to all of my friends and family. It’s been almost 11 years and still runs the same old Windows XP. What more can I say about such a thing which never gave a thought of an OS upgrade.

Yup! Bitter truth is Microsoft wants its users (like me) to upgrade its OS and get moving with the newest ones. Windows XP was a benchmark as to how an OS should be. The ones that impressed me next is Windows 7. Windows 8, yeah I still have to get adjusted with the usage but definitely didn’t impress me yet!

As of April 8, 2014, support and updates for Windows XP are no longer available. Check out this link:

I would definitely miss you!

Categories: Personal Tags: , ,
%d bloggers like this: