Posts

c# - HttpClient does not see "Set-Cookie" header -

i have mvc login form: [httppost] public actionresult login(loginviewmodel viewmodel) { if (viewmodel.username == "alex" && viewmodel.password == "password") { formsauthentication.setauthcookie(viewmodel.username, false); return redirecttoaction("index", "home"); } return view(); } and console app client consumes mvc login action: private static void getperson() { console.writeline("username:"); string username = console.readline(); console.writeline("password:"); string password = console.readline(); using (httpclient httpclient = new httpclient()) { httprequestmessage authrequest = new httprequestmessage(); authrequest.method = httpmethod.post; authrequest.requesturi = new uri(@"http://localhost:4391/account/login"); authrequest....

asp.net - My system.webServer > staticContent > clientCache element obstructs serving CSS, JavaScript, and Images -

i have system.webserver section. when add clientcache line, web server stops serving javascript, css, , images. when remove clientcache line, again starts serving them. wrong clientcache element? this problem occurs both in visual studio development server , when push website azure. <system.webserver> <staticcontent> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="86400"/> </staticcontent> <!--handlers removed clarity--> </system.webserver> in asp.net, clientcache > cachecontrolmaxage property timespan (though http specification makes max-age header seconds .) so, wrong : <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="86400"/> and right : <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="1.00:00:00"/> where iso on one?

php - How to upload a file from a page called already through Ajax? -

the form upload works if not called through ajax first, if tab/page loaded $.get(page+".php", {type: type}, function(d){ $('#maincontent').html(d); }); then malsup jquery plugin doesn't work , redirect url listed in forms action section. how work same way if directly on page? i believe on success of ajax request have re-bind malsup plugin dom gets updated. have add rebinding in success handler.this may solve problem.

php - PHPMailer populating emails from result of query -

i'm trying populate email addresses in phpmailer array returned query. $query = 'select u.id, u.first_name, u.last_name, u.email users u inner join locations l on (u.location_id = l.id) district_id = 8 group id order first_name, last_name asc'; $result = mysqli_query($connection, $query); if (!result) { die("database query failed: " . mysqli_error($result)); } $recipients = array(); while ($row = mysqli_fetch_assoc($result)) { $results[] = $row; } this gives me result such as: array ( [0] => array ( [id] => 1 [first_name] => jon [last_name] => smith [email] => jon@domain.com ) [1] => array ( [id] => 3 [first_name] => dave [last_name] => virk [email] => dave@domain.com ) [2] => array ( [id] => 2 [first_name] => chris [last_name] => west [email] => chris@domain.com ) ) but being new working arrays i'm not sure how extract name , email of each user phpmailer. i read example did this:...

swing - In java socket programming, is it necessary to run server program first before client program? -

i building remote desktop viewer app using swing. when run server first , client, app working fine. but when run client first , server, client gives exceptions there no listening server. what should if run client first , server connection should successful , client should not give exceptions? thanks. connectexception thrown when client tries connect server not started. have retry logic using try{ socket.connect(..) }catch(connectexception ex) { } within loop. delay can added between retry free cpu.

html - Change image color on hover -

Image
i have image have used z-index place box , text on image: here's looks like: and that's done using code: #wrap { position:relative; width: 200px; height: 145px; border: 1px solid grey } #text { z-index: 100; position: absolute; color: white; font-size: 20px; font-weight: bold; padding: 10px; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.7); } and calling function: <div id="wrap"> <img src="/wp-content/uploads/2014/03/brandslang.png"/> <div id="text">brand</div> </div> this image etc used link want give user sort of response when or hovers on image , want have box span on whole image when user hovers on this: i looked @ a:hover i'm not sure how implement affect image , not every single link have on page, , hoping guys me! :) what said correct hover level: http://jsfiddle.net/83n5x/1/ <div id="wrap...

java BigInteger random number in a minimum and maximum range -

in java, it's easy find random number using random() in range. below method i've tried that. public int rand(int min, int max){ random rands = new random(); int numrand = rands.nextint(max-min) + min; return numrand; } but, it's in integer has 2,147,483,647 maximum values. then, need compute values has large number. let's large number 5234960860151076037807790832396537967963815240976924943830782457906435372625549206966897650382309539933354611312768681026528740101 it contains 130 characters of number. can't stored in integer, in double. but, need find large random number that. so, found way random large number using biginteger. at here , random number n-digit. at here , random number 0 n. it's similar this . at here , random number 1 8180385048 . so far, found them useful. i'm still confusing how know whether minimum number 0 or 1 or 123456712312 . i want generate random number using biginteger minimum maximum values...