473,671 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpWebRequest for local file?

Can I construct an HttpWebRequest with a local file
instead of a URL?

It seems like I remember doing this in Java with something
like "file:\\\myfile .txt" in place of the URL.

Thanks,

Drew

Nov 15 '05 #1
1 6429
You cannot construct an HttpWebRequest with a local file. However, you can
construct a WebRequest, which is actually a FileWebRequest.

WebRequest wr = WebRequest.Crea te(file:///c:/a.txt);
MessageBox.Show (wr.GetType().T oString());

This will throw up a messagebox that shows "System.Net.Fil eWebRequest"

-vJ

"Drew" <so*****@hotmai l.com> wrote in message
news:Op******** ******@tk2msftn gp13.phx.gbl...
Can I construct an HttpWebRequest with a local file
instead of a URL?

It seems like I remember doing this in Java with something
like "file:\\\myfile .txt" in place of the URL.

Thanks,

Drew

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2844
by: JohnLH | last post by:
Hi, I am having an issue with the LOAD DATA LOCAL FILE command on the latest 3.0.9 JDBC Driver. The command works on Windows, but doesn't seem to work on OSX and Linux. The error that I get on Linux and OSX is ... Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FILE
20
1992
by: Steve | last post by:
I have a web app that needs to parse through a file that is located on the client machine. I get the file string from a query string & then parse it. It is working fine on my development box but when I put it out on the test server the application is looking for the file on the server & not on the client machine. I am essentially taking the query string & using a stream reader to read the file. I'm sure i'm doing something...
3
10605
by: Christopher D. Wiederspan | last post by:
I've got a WebBrowser control in a C# Windows form. I build HTML on the fly and then set it into the control using the DocumentText property of the control. All of this works fine, except that part of the HTML that I construct is an <A> element that links to a local file, something like this: <A HREF="C:\Temp\SomeFile.htm" TARGET="_blank">Test</A> When I click on the link in the browser control, nothing happens. After some...
2
1630
by: Savane78 | last post by:
Hi all, I'm just wondering if it is possible to upload a local file (using a <input file> but instead of just sending it, applying a treatment (encoding) to the file while sending it. Typically, I would like the file the browser sends to be uuencoded (sent as text), so that the Web server can treat it as any other text field.
3
2746
by: Daniel | last post by:
Is it possible to retain local file system read, write, delete access while impersonating for access to a remote drive in a different domain? I need to be able to move files from a local computer to a remote computer. do i have to copy them from the local computer to the remote computer then delete them fromt the local computer after undo-ing the impersonation? Or is there a way to retain access to both the local computer and the remote...
2
1521
by: Peter White | last post by:
I am trying to transfer a file from a user's local machine (the file is automatically created by a 3rd party tool and stored in the users local settings/temp directory) via a web form to my web server. I am using Visual Studio.Net 2003 and running IIS 5.0. There is no need to use the input=file html control b/c the user has no idea the name of the temporary file that I need to capture and store on the server. I believe the "value"...
5
9469
by: acord | last post by:
Hi, Can anyone tell me how to use XMLHTTPRequest or MS ActivcXObject open a local file? Thanks Sam
5
23432
by: timnels | last post by:
I have a web browser control that I'd like to point at a HTML file in my installation directory. I am doing something like: string path = Path.GetDirectoryName( Assembly.GetExecutingAssembly().GetModules() .FullyQualifiedName) + "\\howdoi.htm"; webBrowser1.Navigate(path); What do I need to do to form the correct URI string for a local file?
8
7783
by: martinsmith160 | last post by:
Hi everyone I am trying to create a simple wpf program that allows a user to select an image from a combo box and then where they click on th screen draw that image at the mouse co-ordinates. The prolem im having is i can load a single local file (a png file) into a bitmapImage source it works perfectly but if i try and store a number of bitmapImages in an array and try and load a local file it always creates a program crash. The first...
0
8474
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8392
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8912
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.