CandyWrapper.CandyWrapper.setURL C# (CSharp) Method

setURL() public method

public setURL ( string sURL, string sUser, string sPass, string sType ) : int
sURL string
sUser string
sPass string
sType string
return int
        public int setURL(string sURL, string sUser, string sPass, string sType)
        {
            NetworkCredential netCreds = new NetworkCredential(sUser, sPass);

            CredentialCache credCache = new CredentialCache();
            credCache.Add(new Uri(sURL), sType, netCreds);

            HttpWebRequest oWebReq = (HttpWebRequest)WebRequest.Create(sURL);
            oWebReq.Credentials = credCache;
            int iResult = 0;

            try
            {
                HttpWebResponse oWebRes = (HttpWebResponse)oWebReq.GetResponse();
                oSugarCRM.Url = sURL;
                iResult = 1;
            }
            catch (Exception ex)
            {
                iResult = 0;
            }

            return iResult;
        }

Same methods

CandyWrapper::setURL ( string sURL ) : int