Download images in all browsers, but not in UIWebView

I have a website that is configured as an application under a different site on my server. all javascript, css and image files are set as relative paths. When I had a site that had a top-level site, everything worked in all browsers, as well as in the mobile application that I created that contains UIWebview.

When I moved the site as an IIS application under another site, everything that was set as src = stopped working. I went through and adjusted the HTML to load Request.FilePath (virtual Path) for all of these, and everything started working again ... except for the UIWebview of my application. Has anyone come across this before and why is this happening? The site works great if I open safari on my phone.

HTML

<% string rootPath = Request.FilePath; %> <img src="<%= rootPath %>/Resources/image.png" /> 

A source

  <img src="/WMS/Resources/image.png"> 

This again works in all browsers (IE, FF, Safari), but when I open it in UIWebView, the image does not load

I am using .NET 4, IIS7, MVC2, iPhone 4 with the latest SDK

Any help would be appreciated

+4
source share
2 answers

I also had this problem, I fixed it with Url.Content. try something like this: src="<%= Url.Content("~/Resources/image.png") %>"

+2
source

Three things come to mind:

  • Caching - does the UIWebView cache refer to a broken link?
  • Is IIS serving static files with the wrong MIME types?
  • (I get here) Is your mobile test device on the same network / domain?
+1
source

Source: https://habr.com/ru/post/1379169/


All Articles