Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - Converting binary characters to something jQuery can use -


i’m using binarywrite method of httpresponse class fetch web page.

something similar example…

filestream myfilestream; long filesize;  myfilestream = new filestream("apage.html", filemode.open); filesize = myfilestream.length;  byte[] buffer = new byte[(int)filesize]; myfilestream.read(buffer, 0, (int)filesize); myfilestream.close();  response.binarywrite(buffer); 

i’m using jquery ajax method response. i’m having trouble doing - if had…

$.ajax({     type: "get",     url: "geturl.proxy",     data: { url: 'http://www.example.org/test.html' },     success: function(data) {         $('iframe').contents().find('html body').html(data.tostring());     },     error: function(xmlhttprequest, textstatus, errorthrown) {     alert(errorthrown);     }  }); 

this returns stream of binary characters, want jquery can use set html element.

set content-type first:

response.clear(); response.contenttype = "text/html"; ... 

in response question of finding content type of file:

string mt = "application/unknown"; string ext = path.getextension(filename).tolower(); var regkey = microsoft.win32.registry.classesroot.opensubkey(ext); if (regkey != null) {   var tempmt = regkey.getvalue("content type");   if (tempmt != null) {     tempmt = regkey.getvalue("content type").tostring();   } } 

personally, i'd switch statement extensions , types...


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -