Thursday, January 15, 2015

Downloading Files in MVC where excel is not actually opened

I inherited from FileResult and it did not download - even though I set download name

I did this and it works

     public FileResult DownloadTextAsAFile(string data, string name)
        {
        string fileName = string.Format("{0}.csv", name);
        byte[] bytes = System.Text.Encoding.UTF8.GetBytes(data);
        return new FileContentResult(bytes, "application/vnd.ms-excel") { FileDownloadName = name };
        }

Wednesday, January 14, 2015

to select a particular forms elements in jquery

just use the form's id as one of the selectors

Force filedownload

response.AppendHeader("content-disposition", "attachment; filename=" + FileDownloadName);

Add an action to a form with jquery

$("#blah").get(0).setAttribute('action', blahURL);

Monday, December 1, 2014

Passing jquery pattern

works because this works

(function (a) {alert(a);})("kl")


Thursday, November 20, 2014

Wednesday, November 12, 2014

app cmd script to allow ipv4 access on iis

%systemroot%\system32\inetsrv\AppCmd.exe set config "blah/subblah" /section:ipsecurity /+"[ipaddress='105.536.551.514',allowed='true']" /commit:appHost