Have you intermittently been experiencing issues with uploads on your ASP.NET site?
Seeing errors thrown like "The given path is not supported"?
I recently stumbled across this issue with a couple of pages. I was able to dig down and fix all of my code to handle uploads again.
It looks like the code I was formerly using to save files to my web server is no longer functioning the way it used to. Previously, I saved files something to the style of:
myFileUpload.SaveAs("C:\uploads\" & myFileUpload.PostedFile.FileName)
When I started exploring the error, I discovered that the file path being generated was:
C:\uploads\C:\Users\robfine\Desktop\myFileToUpload.txt
It seems that the function .PostedFile.FileName no longer returns just the name of the file being uploaded, but rather the entire path the file was located at on the uploader's computer.
It's an easy solution to the issue; all you need to do is use the IO.FileInfo class to extract the name of the file:
Dim myFileName as String = New IO.FileInfo(myFileUpload.PostedFile.FileName).Name
myFileUpload.SaveAs("C:\uploads\" & myFileName)
I've done a little of research and it looks like this may be linked to the browser the end user is using. Some version of IE7 and a couple other browsers throw the entire path of the file out there, while other browsers may only give the filename.
Since you never know what browser your user will be using, it's best to cast the .PostedFile.FileName result into the FileInfo class just to be on the safe side.
Showing posts with label IE7. Show all posts
Showing posts with label IE7. Show all posts
Thursday, January 13, 2011
Wednesday, December 1, 2010
CSS Consistency Issue between IE7 and IE8
While I was creating a short menu out of a bullet list, I observed an inconsistency in padding that surface between websites being viewing Internet Explorer 6 or 7 and Internet Exporer 8.
With IE 8, when I set the margins of my <ul> tags and my <li> tags to 0px, the bulleted list is still indented.

However, with IE 7 and 6, when I set the margins to 0px, the list lines up with the text above it.

From my research and testing, it would appear there is no way to correct for this.
It especially becomes a problem when developing in IE 8 and correcting the margin-left to -30px.
While IE 8 will show the text of the list left aligned with the rest of the text on the page, previous versions of the browser will bleed the list far left beyond the placement of the control's container.

To avoid this problem, the best practice going forward for the next couple years is either to account space for the list to be indented or avoid using lists.
With IE 8, when I set the margins of my <ul> tags and my <li> tags to 0px, the bulleted list is still indented.

However, with IE 7 and 6, when I set the margins to 0px, the list lines up with the text above it.

From my research and testing, it would appear there is no way to correct for this.
It especially becomes a problem when developing in IE 8 and correcting the margin-left to -30px.
While IE 8 will show the text of the list left aligned with the rest of the text on the page, previous versions of the browser will bleed the list far left beyond the placement of the control's container.

To avoid this problem, the best practice going forward for the next couple years is either to account space for the list to be indented or avoid using lists.
Labels:
bulleted list,
consistency,
css,
HTML,
IE7,
Internet Explorer 7,
li,
margin,
ul