I have a WebBrowser element in my UI, I can make it navigate to a hosted page, but when I want it to load a local webpage (which is in my solution resources), which is the exact html file hosted on internet, it just shows a blank page.
browser.Navigate(new Uri("test.html", UriKind.Relative));
If I change the UriKind or the page name it shows an error that the file could not be found, so I know the browser is finding the webpage correctly but it won't render it.
I need to do this because I want to show the page while the user is offline.
If the html file has a build action of Content you can access it directly from the install location if you set a relative path.
If you want to be able to navigate between pages or include other resources in the file (including external css, js or even images) then you'll either need to copy all the files to IsolatedStorage and view them from there or host them externally.
Edit:
MSDN has an article which explains copying files to IsolatedStorage, so they can be viewed in the WebBrowser control, at http://msdn.microsoft.com/en-us/library/ff431811(v=vs.92).aspx
The browser cannot read a resource from your App/Dll. However, it you have the file in the same folder as you application you could do:
var home = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
browser.Navigate(new Uri("file://" + home + "/test.html");
Related
I have this image URL i got from database.
\\Imagepath\ImageFolder\image.png
but i need to put in a img tag in html to show the image in the page, i try to do this way
<img src='\\Imagepath\ImageFolder\image.png'/>
but the page adds the default url for localhost, ie.
http://localhost:1234/\\Imagepath\ImageFolder\image.png
I need your helpfor trying to get the image from that server URL.
I have a lot of images around 6,200 so is not an option to download, i'm show the images in a table.
NOTE: i know the img tag not accept the URL like i have, but maybe you have an idea to do in ASP.NET, i apretiate your help.
NOTE 2:i'm using ASP.NET MVC.
Paths starting with \\ are UNC paths, they are not URLs. In a browser, you have to use a URL to load an image.
The browser is assuming you've tried to specify a relative URL, and is attempting to add the current URL by default in order to fully qualify it and then make a request to it to get the image.
You need to map the path to a virtual directory in your webserver and then point the image's src property at the URL of that virtual directory.
Alternatively, if that's not a workable solution you could write an MVC action method which takes the name of the image file as a parameter and then loads the image from the UNC path in the background and returns the data in a binary response to the browser.
We are running DNN 9.1.1 on a local network without internet.
A fontawesome CSS is loaded through CDN and we cannot find where is it defined.
Like showed in the below image the CDN is a not resolved host and fontawesome is not loaded:
I search in all my web folder, in the DB and DNN github sources but I don't find anything.
How can change the URL for loading locally fontawesome CSS?
Is it definided somewhere else?
Have you tried doing a text search for "font-awesome" inside all your skins folders: /Portals/_default/Skins/ ?
From your screenshot it looks like you're using Client Resource Management. Try disabling this, reload the site and right click > view page source on this page you posted. You should then be able to find the reference to font-awesome.
It appears to be added all the way at the bottom of the page below the </form> element. And then only when site is in Edit mode.
<!--CDF(Css|https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css?cdv=75)-->
A bit strange because all the core files are usually contained withing the DNN site itself. And it is the only file that is loaded from maxcdn.bootstrapcdn.com. The only other externally loaded file is an Open Sans font from fonts.gstatic.com
I'm trying to download a zip file (that is normally accessed/downloaded by pressing a button on a web page) using C#.
Normally the file is downloaded by selecting "Data Export" and then clicking the "SEARCH" button at this URL:
http://insynsok.fi.se/SearchPage.aspx?reporttype=0&culture=en-GB&fromdate=2016-05-30&tomdate=2016-06-03
If trigger the download manually on the webpage and then copy the download url from the 'Downloads' view of chrome or firefox I get the exact same URL as above. When I paste that in a browser window I will not trigger the download, instead the above page will be loaded and I have to trigger the download manually in the same way as in the first place.
I've also tried using the network tab of the inspector to copy the request header of the request that is triggered when clicking the "SEARCH" button, but that URL is also the same as the one above.
Trying with C# I get the same result, the page itself is downloaded. My code looks as follows:
using (var client = new WebClient())
{
client.DownloadFile("http://insynsok.fi.se/SearchPage.aspx?reporttype=0&culture=sv-SE&fromdate=2016-05-30&tomdate=2016-06-03", "zipfile.zip");
}
My guess is that my code is correct, but how do I get the correct URL to be able to download the file directly?
ASP.net inserts a bunch of crap into the the page to make things like this particularly hard. (Validation tokens, form tokens, etc).
Your best bet is to use a python library called Mechanize, or if you want to stick to C# you can use Selenium or C# WebBrowser. This will fully automate visiting the page (you can render the C# WebBrowser invisible), then just click the button to trigger the download programatically.
I am trying to locate a .mp4 file from this following URL programatically.
https://twitter.com/ERA_fm/status/691183877411328001/video/1
when this page is opened in a web browser and when I debug through inspect element I can see the .mp4 file in the <video> tag embedded in an iframe.
Now I have written this code to download the url which is as follows:
string siteUrl = "https://twitter.com/ERA_fm/status/691183877411328001/video/1";
string html = new System.Net.WebClient().DownloadString(siteUrl);
I see the downloaded source does not contain any video element associated with it, rather there is no iframe element at all.
Hi guys this is my follow up question and I think this is the real issue here. Click Here
Whenever I access the file using the directory browsing (eg. http://localhost/temp/1.pdf) it always render the old or previous PDF file even if I change the entire file with the same file name, example I have 1.pdf with some content then I delete this file on the directory then replace with new and different content and rename it to 1.pdf then when I access it using browser it always render the previous value not the new one that I replace. This only happens on IE and Opera browser. Please need help this is a production issue.
Edit:
I found something very strange, example i have this url for the location of the pdf file (eg. http://localhost/website/tempfolder/1.pdf) the first pdf that I generated will show then some part in my code I change the casing of some letter example 't', I change it to 'T' then the newly pdf shows but when I revert back to the old case expecting that it will show the new pdf but sad to say the first PDF file shows.
Your browser is probably caching the PDF files.
For IE, you can do a CTRL F5 to force it to reload from web server.
Or put a random query string in your URL
e.g. /temp/1.pdf?v=1, /temp/1.pdf?v=2
Assuming you server is IIS, permanent solution is to configure HTTP response headers.
Go to IIS manager
Navigate to your folder
Click "HTTP Response Headers" in Features View
Right-button click/select "Set Common Headers"
Check "Expire Web Content" and select "Immediately".