0

I am having a problem similar to this: https://forums.xamarin.com/discussion/6319/problem-with-webview-and-url

Using a UIWebView, I am trying to pass a URL with a querystring. The URI looks like this: "Content/Content/holder.html/?contentpath=/test.html"

Without the querystring, the document displays correctly. However, with the querystring, I get the following error:
Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server."

It seems as though it's not separating the query string.
I've read some C solutions, but I can't manage to reflect that in my C# solution; particularly

NSString *URLString = [url absoluteString];   
NSString *queryString = @"?param1=1"; 
NSString *URLwithQueryString = [URLString stringByAppendingString: queryString];  

1 Answer 1

1

Found my answer here: https://forums.xamarin.com/discussion/10444/uiwebview-loadrequest-encoding-url-so-becomes-3f

The UIWebView does not like spaces in the URL:

var escapedBundlePath = Uri.EscapeUriString(NSBundle.MainBundle.BundlePath);
var myUrl = "Path/To/File/Test.html?var1=hello&var2=world";
var nsUrl = new NSUrl(Path.Combine(escapedBundlePath, myUrl));

WebView.LoadRequest(new NSUrlRequest(nsUrl));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.