Posts

Showing posts with the label CS

c# WebRequest error An existing connection was forcibly closed by the remote host

“An error occurred while making the HTTP request to https://<API endpoint>. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.”  Inner exception was “ Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ” this happened to me when doing some HttpWebRequests and suddenly everything stopped working. apparently the server changed protocol to Tls1.2, and that caused all the mess. PLUS i was using .Net4 so no enum there, so here is the magic line for all you problems   ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

How i've won MS : Sort Content Search Web Part via JS, and all other functions that should be from the QS

Image
my scenario was ordering the search results, and i really wanted to make it with CSWP, and my CTO wanted the odering via QS, so he found me this: http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/01/09/how-to-sort-search-results-by-query-string-with-the-resultscriptwebpart-in-sharepoint-2013.aspx that was great until it needed to be embedded with some OOTB refiners, my little script overran sharepoint's OOTB behavior since they use the QS as well, and so started the fight to find how to do it OOTB. in the beginning i found zelion posts about "Srch.U.fillKeywordQuery", which is great but i couldn't find that JSON object. i then looked into the objects on the page and found that my object was  "Srch.QueryState", but no way was found to update it and send the request. but i didn't gave up. all those posts with all those ways to refresh the "Search Content WP" made me feel that there is a way, a simple way that does not i...