|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
file:// scheme and directoriesUnder firefox, if you enter in the URL
file://c:/ You'll get an HTML-ized version of the C:/ directory. Under IE, it actually redirects to a regular Explorer window showing your c:\ folder. But if you try to use .NET WebRequest.Create("file://c:/"), at least with .NET 1.1, you get an "Access to the path "c:\" is denied" error, which seems a bit rude. There's actually nothing in the documentation that says if you're using the file:// scheme you can't reference a directory, but obviously it's not designed to work. Is this any different in .NET 2.0, and if not, is there any likelihood of it changing in the future? wizof***@hotmail.com wrote:
Show quote > Under firefox, if you enter in the URL Note that the name of the class in .NET is HttpWebRequest - it only serves > > file://c:/ > > You'll get an HTML-ized version of the C:/ directory. Under IE, it > actually redirects to a regular Explorer window showing your c:\ > folder. > > But if you try to use .NET WebRequest.Create("file://c:/"), at least > with .NET 1.1, you get an "Access to the path "c:\" is denied" error, > which seems a bit rude. There's actually nothing in the documentation > that says if you're using the file:// scheme you can't reference a > directory, but obviously it's not designed to work. Is this any > different in .NET 2.0, and if not, is there any likelihood of it > changing in the future? the Http scheme, and I wouldn't expect that to change. You could derive your own FileWebRequest class and register the file: scheme with the WebRequest class. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconprogrammingpluggableprotocols.asp for details. -cd Carl Daniel [VC++ MVP] wrote:
Show quote > wizof***@hotmail.com wrote: The file:// scheme is definitely supported (by means of> > Under firefox, if you enter in the URL > > > > file://c:/ > > > > You'll get an HTML-ized version of the C:/ directory. Under IE, it > > actually redirects to a regular Explorer window showing your c:\ > > folder. > > > > But if you try to use .NET WebRequest.Create("file://c:/"), at least > > with .NET 1.1, you get an "Access to the path "c:\" is denied" error, > > which seems a bit rude. There's actually nothing in the documentation > > that says if you're using the file:// scheme you can't reference a > > directory, but obviously it's not designed to work. Is this any > > different in .NET 2.0, and if not, is there any likelihood of it > > changing in the future? > > Note that the name of the class in .NET is HttpWebRequest - it only serves > the Http scheme, and I wouldn't expect that to change. > FileWebRequest), but it only appears to work with files, not directories, that was my point. wizof***@hotmail.com wrote:
Show quote > Carl Daniel [VC++ MVP] wrote: Ah, I missed that detail. What would you have it return in the response if >> wizof***@hotmail.com wrote: >>> Under firefox, if you enter in the URL >>> >>> file://c:/ >>> >>> You'll get an HTML-ized version of the C:/ directory. Under IE, it >>> actually redirects to a regular Explorer window showing your c:\ >>> folder. >>> >>> But if you try to use .NET WebRequest.Create("file://c:/"), at least >>> with .NET 1.1, you get an "Access to the path "c:\" is denied" >>> error, which seems a bit rude. There's actually nothing in the >>> documentation that says if you're using the file:// scheme you >>> can't reference a directory, but obviously it's not designed to >>> work. Is this any different in .NET 2.0, and if not, is there any >>> likelihood of it changing in the future? >> >> Note that the name of the class in .NET is HttpWebRequest - it only >> serves the Http scheme, and I wouldn't expect that to change. >> > The file:// scheme is definitely supported (by means of > FileWebRequest), but it only appears to work with files, not > directories, that was my point. you requested a directory? The browsers you mention are fabricating a document in some unspecified format and returning that, or popping up an entirely different type of window - neither of which falls within the purview of a web request. You could implement your own FileWebRequest class that fabricates some kind of document when you request a directory, but strictly speaking, a web request fetches a document, and a directory is not naturally a document that can be returned. -cd |
|||||||||||||||||||||||