Exemple #1
0
		public void Navigate(string url, System.Collections.Generic.List<Header> Headers)
        {
            if (loaded)
            {
                if (url.StartsWith("javascript::"))
                {
#if DEBUG || RELEASE
                    try
                    {
                        GetScriptManager.EvaluateScript(url.Split(Convert.ToChar("::"))[1]);
                    }
                    catch (Exception ex) { Error(this, new WebKitBrowserErrorEventArgs("JavaScript execution failed: " + ex.Message)); }
#else
                    try
                    {
                        StringByEvaluatingJavaScriptFromString(url);
                    }
                    catch (Exception ex) {Error(this, new WebKitBrowserErrorEventArgs("JavaScript execution failed: " + ex.Message)); }
#endif
                    return;
                }
                // prepend with "http://" if url not well formed
                if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
                    url = "http://" + url;
                else
                    url = "" + url;
                activationContext.Activate();

                WebMutableURLRequest request = new WebMutableURLRequest();

                request.setHTTPMethod("GET");
                
                request.initWithURL(url, _WebURLRequestCachePolicy.WebURLRequestUseProtocolCachePolicy, 60);
                
                if (Preferences.IgnoreSSLErrors)
                    request.setAllowsAnyHTTPSCertificate();

                if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
                    request.setValue("Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(string.Format("{0}:{1}", Username, Password))), "Authorization");
                
                foreach(WebKit.Header h in Headers)
				{
					request.setValue (h.Value, h.Field);
				}
                webView.mainFrame().loadRequest((WebURLRequest)request);

                activationContext.Deactivate();
            }
            else
            {
                if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
                    url = "http://" + url;
                initialUrl = url.Length == 0 ? null : new Uri(url);
            }
        }
 public void willSendRequest(WebDownload download, WebMutableURLRequest request, WebURLResponse redirectResponse, out WebMutableURLRequest finalRequest)
 {
     finalRequest = request;
 }
 public void willSendRequest(WebDownload download, WebMutableURLRequest request, IWebURLResponse redirectResponse, out WebMutableURLRequest finalRequest)
 {
     finalRequest = request;
 }
 public HeadersAvailableEventArgs(Uri url, WebMutableURLRequest reqest)
 {
     this.Url = url;
     this.req = reqest;
 }
 public HeadersAvailableEventArgs(Uri url, WebMutableURLRequest reqest)
 {
     this.Url = url;
     this.req = reqest;
 
 }
Exemple #6
0
 public void willSendRequest(WebDownload download, WebMutableURLRequest request, WebURLResponse redirectResponse, out WebMutableURLRequest finalRequest)
 {
     throw new NotImplementedException();
 }