This project is read-only.
1
Vote

Secure search fails

description

Hi,
I am trying to perform a secure search from the C#.Net code.The search fails with a 417:Expectation failed error. I am also sending the default network credentials from my code.
It works fine when I perform the secure search from the google interface.

Details:
SSL Settings->Force secure connections when serving? ->The following option is selected.
Use HTTPS when serving secure results, but not when serving public results.

I can also see the current SSL certificate information in GSA.


Serving Logs:

I can see the query request given from my .Net app in the log.The log ends after redirecting the authentication to SAML.Is there anything additional to be sent along with the request other than the user credentials?
My search URL looks like this:
https://searchsc-dev.intel.com/search?q=spp&access=a&as_occt=&num=10&start=0&as_sitesearch=&filter=1&ie=utf8&oe=utf8&lr=&getfields=vc&UserQuery=spp&userInfo=ashaale1&site=A000_iSearch%7cP002_AllVC%7cP002_emb&client=A000_iSearch&output=xml_no_dtd


My SecureSearch function looks like this.

private string PerformSecureSearch(string googleSearchURL)
    {
        Uri contentURL;
        HttpWebRequest webRequest;
        HttpWebResponse webResponse;
        Stream responseStream;
        StreamReader streamReader;
        string searchResults = "";
       int i = 0;

        try
        {

            contentURL = new Uri(googleSearchURL);

            // Create a new web request
            webRequest = (HttpWebRequest)WebRequest.Create(contentURL);
          webRequest.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
            webRequest.Method = "GET";

            //Trust all certificate
            System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
            System.Net.ServicePointManager.Expect100Continue = false;

            // Invoke the web request and get the response back via HTTP
            webResponse = (HttpWebResponse)webRequest.GetResponse();



            // Get the XML response back and pass the data back "as-is".
            responseStream = webResponse.GetResponseStream();
            streamReader = new StreamReader(responseStream);
            searchResults = streamReader.ReadToEnd();
        }
        catch (WebException ex)
        {
            _errorOccurred = true;


            // Throw the exception so that the calling application can handle it
            throw (ex);
        }
        catch (Exception ex)
        {
            _errorOccurred = true;

            // Throw the exception so that the calling application can handle it
            throw (ex);
        }

        return searchResults;
    }

Can you please provide with a working C# implementation for secure search?

Regards,
Asha

comments