Why is my <a href="test.xls"> is working and .txt is not? - asp.net

I have a folder named Test. I have some .xls files and .txt , .doc files in it.
In the html I have
<p> Download excel file </p>
- when I click on this link it is opening a download window (Working fine)
<p> Download Text file </p>
<p> Download excel file </p>
But these 2 are not working. Instead of opening a download window they are going to that .doc file link and saying that the page cannot be found.
why the download window is coming for .xls and not for .do or .doc? How can I fix this??

You need to configure your server's MIME types, otherwise either the file will not be served up (and you'll get a 404) or the browser will not know how to handle the type of file.
See this article for more information.

Sounds silly, but I'm guessing that you need to check the file names and references to them and make sure they are exactly the same. Unless you are on a Windows box, case sensitivity is something to take into account too.

You would want to check this http://www.west-wind.com/weblog/posts/2007/May/21/Downloading-a-File-with-a-Save-As-Dialog-in-ASPNET

Related

Angular2 - File download not working if the file name contains spaces

Hi have a simple link that point to a file for download:
working file link
<a href="/assets/test/myFile.pdf" download>This Works</a>
The link works but if I try to implement a download link to a file with name that contains spaces, I get a corrupted file:
not working file link
<a href="/assets/test/my File not work.pdf" download>click here to download</a>
If I check the content of the corrupted file, I can find the html content of the homepage...
How can I manage the link to download for files that contains spaces?
Thanks
Space characters aren't allowed in URL's, so you have to encode them. Have you tried to change the name of the underlying file and referencing that?

Show .txt file on a Hyperlink using WordPress

I want to show a text file online as a description when users click on a link, and I want it to be a text file, not the html page. I want it just like this link https://wordpress.org/plugins/about/readme.txt.
I have uploaded the .txt file and it opens when the user clicks hyperlink, but contents of that .txt file are not shown....
Any idea what I did wrong?
Its about File-Permissions, you have to set them to Public & Read
This solution is provided to "Online Sites" only. (Not for XAMPP)
Go to Your Admin Panel
Go to Media
Upload your Textfile to your Webserver
Browse your Textfile (via FTP-Client) and make a RightClick
Set CHMOD to 744. (read)(This are File-Permissions)
Open the File in your Browser and it should appear normally.
I've tested it 5 Minutes ago, it should work for you.
If you check the link using Developer Tools (on Chrome) or using Firebug (on Firefox), you'll know that the file is missing. You have not uploaded the file to that location.

Why are these resources failing to load?

My asp.net project has several .png (and a few .gif) files in the \Content\Images folder.
Two are not found; Chrome Dev Tool's Console tells me: "Failed to load resource: the server responded with a status of 404 (Not Found)"
...and sure enough, if I click the links that it shows (e.g., http://localhost/#System.Configuration.ConfigurationManager.AppSettings[%22ThisApp%22]/Content/Images/PlatypusorangeSprite.png) it takes me to GDT's Resources tab, and although the Images folder shows that file as being there, but there is a "broken image" representation of it.
The same thing happens with just one other image file (they are all in the same location, and the references to them, in CSS file declarations, is indeed pointing to where they exist, such as:
background:#E5EDFE url('/#System.Configuration.ConfigurationManager.AppSettings["ThisApp"]/Content/Images/PlatypusorangeSprite.png') repeat-x 0 -369px;
I can 2-click those files in the VS2010 IDE, and they open up and seem to look fine.
So why are they not being found at browsetime/seen as broken images?
UPDATE
Well, apparently it's got someting to do with my moving all the style declarations out of the cshtml file into a separate stylesheet/CSS file that is referenced in the page (I went back to the bad old way and it works fine - the pngs are found again (I even imagined that I heard them singing "Amazing Grace")). Since it is not a relative path to those pngs, why would it matter that the style info is in a .css file in the Content folder as opposed to being "inline"?
I hate it when you do the "right" thing and it makes things worse.
Some clients accidentally transform suffixes to big letters like .JPG or .PNG. If you call them by .jpg or .png, it will not match.
Render your template by compiling in Visual Studio, open your browser, look into your HTML and check the rendered path of your image:<image src="..." />. Alternatively, try to call the image direcly via ftp by url in browser like ftp://www.mysite/pics/ for example and click on link, that shows the image. Then you get the correct path in the url.
Also check if the suffix ist accidentally doubled like mypic.jpg.jpg.
Any case sensitivity discrepancies,perhaps?

Opening an Excel .xlsx file in IE and following its embedded hyperlinks back to file server

I have an intranet site that lets users open files in the browser (by prompting for download). One of these files is an .xlsx workbook that contains hyperlinks which point to different locations of files (.pdfs, .docs) on the file server in which the .xlsx workbook is located.
It seems the file server path to the workbook is replaced by a "Temporary Internet Files/Content.IE5/" path, leading to the warning "cannot open the specified file" in Excel.
I tried downloading the Excel document first and then following the links, but they're still opening in the temp internet location
EDIT:
For instance, when hovering over the hyperlinks in excel they read: "file:///C:\Documents And Settings\%username%\Local Settings\Temporary Internet files\Content.IE5\40WSS3CB\" + filename
when they should read: "file:///\servername\Departments\Read\" + filename
How can I still open the excel file in the browser and retain the hyperlinks inside and have them not be replaced by the temporary internet files path?
can someone point me in the right direction ? Thanks!
I did some testing, and it almost comes from the way you store links. If you browse through the dialog of Insert hyperlink, then you will end with relative urls. That is, the common base is stored as a reference to the current xlsx file path, and the remainder is stored and displayed as link.
You are totally in the issue Richard Hare mentions, so following the procedure from the microsoft support site should help. It did the trick on my test at least.
UPDATE to sum up down.with.the.bass comments :
One option to solve this, if doable, is to open xlsx file from its network share location and not through the website. If it is forbidden for whatever reason, you may be able to update the links using a macro.
Do you have an option like "Update links on save" enabled?
In an earlier version of Excel it was set in Tools, Options, General-tab, Web Options-button, Files-tab.
Try unchecking it and resaving the document.
I just did in my server the same task (the one I understood):
Uploaded the hyperlink to some asp.net webpage.
<p>
test<br />
</p>
The "book1.xlsx" file has inside a cell which refers (hyperlinks) to some share directory (i.e \\NHSTXX1\TEST\MS OFFICE EXCEL - \\SERVERNAME\FOLDER\OTHER FOLDER )
And when clicked the hyperlinked cell, it opened the share directory I was looking for.
I tried with Firefox.
hope this help
Hyperlinks shouldn't just mysteriously change. I saved an excel file with a hyperlink in it - opened it with html - saved it - open it in excel again - and the link stays the same. So I'm not sure how this could be happening to you(if I understand your situation correctly).

Adobe Dreamweaver: code highlighting in unrecognized file types (like ".master")

Dreamweaver dose not activate code highlighting/hinting/error-checking unless you are using a file type that it knows, (.php .htm .html .css .js .aspx etc) but I am working on a project written in ASP.NET and I have an issue, Dreamweaver doesn't recognize all the ASP.NET file types. .aspx works, and .vb works but .master files show as plain text, no hinting/highlighting no design view. I can edit as .aspx and then save-as constantly but it is a big hassle. Dose anyone know a way to make Dreamweaver think it is editing a .aspx (for proper hinting) but actually be a .master?
For other people who may well be having the same problem following the instructions on this Adobe page, as #rtpHarry rightly points out there is another version of the document that needs updating.
I think this will work for CS5, but the instructions below is for Dreamweaver Creative Cloud.
Close Dreamweaver, go to
C:\Users[user]\AppData\Roaming\Adobe\Dreamweaver
CC\en_US\Configuration\DocumentTypes
Open MMDocumentTypes.xml in Notepad. Note that this Roaming Data is a hidden folder so you may need to change your Windows settings
Change the line for the type of file extension you want to edit. For example, adding a .CSHTML extension to enable regular HTML Code Coloring goes from this:
<documenttype id="HTML" internaltype="HTML" winfileextension="html,htm,shtml,shtm,stm,tpl,lasso,xhtml" macfileextension="html,htm,shtml,shtm,tpl,lasso,xhtml,ssi" file="Default.html" writebyteordermark="false" mimetype="text/html">
To this
<documenttype id="HTML" internaltype="HTML" winfileextension="cshtml,html,htm,shtml,shtm,stm,tpl,lasso,xhtml" macfileextension="cshtml,html,htm,shtml,shtm,tpl,lasso,xhtml,ssi" file="Default.html" writebyteordermark="false" mimetype="text/html">
Reopen Dreamweaver and see the changes!
Are you on a Mac? If so, it (probably) shouldn't be more than a little digging in the .APP's PLIST file... something like:
<dict>
<key>com.adobe.dreamweaver</key>
<string>ASPX</string>
<key>public.filename-extension</key>
<array>
<string>aspx</string>
<string>QQZYX</string> <!-- add this line -->
</array>
<key>public.mime-type</key>
<string>text/html</string>
</dict>
I'm on a Windows machine right now, so I can't verify this myself, but you should be able to right-click, open Dreamweaver as a "bundle," open Contents, open the info.plist file with a text editor (Smultron, TextMate) and add another string to the file-extension association array for ASPX files.
In my example, both .aspx files and .qqzyx files will open as ASPX files. You're using Dreamweaver so I assume you're familiar with XML :)
Update: Looks like you want the Extensions.txt file. Instructions here:
http://kb2.adobe.com/cps/164/tn_16410.html

Resources