I want the users of my webapp to be able to click an href link leading directly to the content of .csv files located on the IIS server, just as if it was a .txt file. I don't want the browser to open the download file dialog which obviously forces the users to download the file in order to see it quickly and that's not what I want.
In a nutshell, (how) can we force the browsers to display csv files as text/plain without having the hand on the http requests (href link) ? Is it possible in IIS 7 ?
Thanks a lot.
Related
Is there any way to set up IIS in a way that no file can be downloaded? (without xml configuration and using the IIS UI only).
I know I can remove all mime-types but that is inconvenient, I'm looking for a better option.
You cannot stop of css or js as the server cannot differentiate between a normal
request and a download request when it comes to css or js.
Say you have a CSS or js included in your webpage any html page .This css file will need to be downloaded by the browser.So at server side(IIS) you cannot differentiate a normal download request or browser request. You can deny the download request if the referrer is not matching.For example if someone take sthe URL and directly copying and pasting it in another browser,the referrer header will not be present.Similarly if someone else hotlink to your resources(css,js files),you can stop that too.
By deny download based on Referrer using URLRewrite
My website has some of its files temporarly saved in the web browser cache.
Concerning CSS and images files, no problem but for some files it's a real security issue.
Is there a way to prevent some files from :
- being downloaded from the cache ?
- being visible in the cache ?
or crypt them maybe
Thanks.
David
Well you can configure your webserver so it sends certain http headers for certain file types such as javascript. For example for Apache web server we can use mod_expires module.
Another option is to add a random string to the end of each file that should not be cached by the web browser. for example the file script_name.js can be server as script_name.js?somerandomstring
A web page which is shown in a browser consists of HTML document and some objects such as CSS, JS, Image, etc. I want to save all of them on my hard disk using wget command to load it later from local computer. Is there any chance?
Note: I want a page not all pages of a web site or something similar.
Use following command:
wget -E -k -p http://example.com
Detail of switches:
-E :
If a file of type application/xhtml+xml or text/html is downloaded and the URL does not end with the regexp .[Hh][Tt][Mm][Ll]?, this option will cause the suffix .html to be appended to the local filename. This is useful, for instance, when you're mirroring a remote site that uses .asp pages, but you want the mirrored pages to be viewable on your stock Apache server. Another good use for this is when you're downloading CGI-generated materials. A URL like http://example.com/article.cgi?25 will be saved as article.cgi?25.html.
-k
After the download is complete, convert the links in the document to make them suitable for local viewing. This affects not only the visible hyperlinks, but any part of the document that links to external content, such as embedded images, links to style sheets, hyperlinks to non-HTML content, etc.
-p
This option causes Wget to download all the files that are necessary
to properly display a given HTML page. This includes such things as
inlined images, sounds, and referenced stylesheets.
In my webpage I have a link to a text file something like this.
Link
When I click on the link the browser downloads the file rather than opening it in the browser.
can anyone tell me how I can do this. Is there any browser changes I need to make..? The link actually is a direct link to the text file itself, and not redirecting the request from a different page. Thanks in advance.
check the HTTP headers that are being used to serve the file, you many need to
fix the server so that it uses the correct mime-type and disposition when serving the file.
If the browser doesn't recognise the type or sees "Disposition: Attachment" it will save the file.
Either change your file to .html or change your webserver mime-type settings to display .txt files.
is it possible to redirect a link to a pdf file?
This is my site: www.mysite.com
And I createad a redirect link that if I open www.mysite.com/documentation - an index.html file will open but for now this index.html file says it's under construction.
Can I redirect the link to a pdf file?
I uploaded the pdf file into the server. So that if I open www.mysite.com/documentation, my pdf named as thedocument.pdf will open.
Is it possible?
If your web hosting provider won't allow you alter the default extensions (i.e. to add pdf) then you could create a HTML page to act as the landing page and then redirect to the PDF.
Details here: http://www.web-source.net/html_redirect.htm
Yes, this is possible. Check your web server configuration that currently points /documentation to index.html, and change it to point to thedocument.pdf.
Be aware that the PDF may or may not load in the user's browser. Some configurations will prompt the user to download the file.
You can achieve this with a modX Weblink.
Upload your pdf to a place from where it is publicly downloadable. For this example I will upload it to modx/assets/content/test.pdf. You should now be able to download your file from http://yourdomain.tld/assets/content/test.pdf.
Create a new weblink resource in modX (Site -> New Weblink) on the base level of your resource-tree. Make it a container and type in 'documentation' as the alias of your resource. You should also make sure, that you already use friendly urls, but your question sounds like you're already doing this.
A weblink has a field to enter the 'weblink' instead of the ressource content. Just use the URL from which you are already able to download your pdf-file. In this example, this would be http://yourdomain.tld/assets/content/test.pdf.
If you now view the newly created weblink resource under http://yourdomain.tld/documentation, you should instantly download a copy of your file test.pdf.