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# - Programatically import cert into IIS? -


i have .pem certificate ssl, want distribute web application in msi (has run on clients' computers). need import (into credentials store?) , tell site bindings use it. how can in code? i've discovered microsoft.web.administration, not sure go there …

this in iis7 btw.

edit: goal here have web application customers can run on intranets. acts api iphone app. (maybe isn't best design we're locked in now.) customer installs msi, , voila, have web service. there needs password authentication between iphone , web service; simplest way seemed to in https. made self-signed cert.

i'm aware redistributing single cert bad idea, we're trying defeat casual hackers here … going intranet , businesses only, seems unlikely going doing crazy, , api severely restricts amount of bad things able database anyways.

so there go, goal have password authentication on intranet web app, one-click(ish) installation. :-d

the answer, dear readers, this:

// assume 'site' set site via  // site site = mgr.sites.add(sitename, directory, 443);  x509store store = new x509store(storename.my, storelocation.localmachine); store.open(openflags.openexistingonly | openflags.readwrite);  // here, directory install dir, , (directory)\bin\certificate.pfx cert file is. // 1234 password certfile (exported iis) x509certificate2 certificate = new x509certificate2(directory + @"\bin\certificate.pfx", "1234");  store.add(certificate);  var binding = site.bindings.add("*:443:", certificate.getcerthash(), store.name); binding.protocol = "https"; store.close(); 

thanks random thread: http://forums.iis.net/t/1163325.aspx


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 -