PM's Blog

Pramod Mohanan's notes about ASP.NET, MVC, C#, SQL, jQuery, Bootstrap

ASP.NET

Dynamic resizing of Images

Front end users are free to upload images of any size, However for uniformity its often necessary to resize these images to a standard width and height but still maintaining the aspect ratio. The following function is what I use to to resize an image dynamically. The file thus returned can then be renamed and […]

Avoid Redirect to Login Page

When the following authorization is set in the config file at the site’s root, inside the system.web node, we notice that no object is rendered unless the user gets authenticated. This also includes images, style sheets, javascripts etc. <authorization>     <deny users="?" />     <allow users="*" /> </authorization> In cases like these, we […]

Cross Domain Ajax using jQuery

Browsers by default don’t allow cross domain ajax. Conceptually we can implement JSONP (see http://en.wikipedia.org/wiki/JSONP) using jquery to do this. Here is an example <script type="text/javascript"> $(document).ready(function () {    var s = $.ajax({ url: "http://someotherdomain.com/page?callback=?", context: document.body, dataType: "jsonp" }); }); function populate(data) {   $(".info").html(unescape(data)); } </script> <button id="btn" value="click me" /> <div […]

Page 1 of 212
PM's Blog © 2015