Question: I have a MVC3 application with ASPX view engine. My page is having a dropdownlist created by 

```
Html.DropdownListFor(m=>m.EmpId,(selectlist)Model.EmpDetails).

```

I update this dropdown on a situation where it would have only one item and make that disabled, by Jquery. Now when I go to form post, my model's `'EmpId'` property is not updated with the corresponding value of its selected item in dropdown list. I suspect, since the dropdownlist is not manually selected (updated by Jquery), I'm not getting `'EmpId'` in my model. Is there a way to overcome this issue?

With regards,
Saravanan

Answer: 
You can look at the `Content-Type` HTTP header to figure out what *type* of file you are getting — but you can't find out what the filename used on the server is (or even if there is a filename), and (in most cases) both index.html and default.asp will return an HTML document.
You can't really use the URL to determine the type of response you get. What you need is the [MIME type](http://en.wikipedia.org/wiki/Internet_media_type) from the [Content-Type](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17) response header.

You can extract this header from the automatically populated [$http\_response\_header](http://uk3.php.net/manual/en/reserved.variables.httpresponseheader.php) variable. Here's an example which will get the contents of a URL, and maps the Content-Type of the response to a file extension....

```
$typeMap=array(
        'text/html'  =>'.html',
        'text/plain' =>'.txt',
        'image/jpeg' =>'.jpeg',
        #you get the idea...
);

$html=file_get_contents("http://www.google.com");

$ext='.html';//assume html, and prove otherwise....

//examine the headers
foreach($http_response_header as $hdr)
{
        list($name,$value)=explode(':', $hdr, 2);
        if ($name=='Content-Type')
        {
                #naive parse of content type
                list($type,$extra)=explode(';', $value, 2);
                if (isset($typeMap[$type]))
                        $ext=$typeMap[$type];

                //no need to look at more headers
                break;
        }
}

```