473,785 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Posting HTTP commands using C#

Hello all,

I have to make a small app that will do the following.

1. Connect to a webserver and get a directory listing.
2. I have to download each file in the specified directory.
3. Once the file is downloaded, enter the data into a SQL2k database.
4. After the file is parsed, I have to delete the file.

I was able to successfully complete steps 1-3 using the
System.Net.WebC lient class. Step #4 is somewhat difficult because there's
no file delete method in the WebClient class.

Using network monitor I was able to sniff out the HTTP command that would
allow file deletion.
----------------------------------------------------
DELETE filename.txt
HTTP/1.1
Accept-Language: en-us
Destroy: NoUndelete
Translate: f
User-Agent: Microsoft Data Access Internet Publishing Provider DAV 1.1
Host: 192.168.XXX.XXX
Content-Length: 0
Connection: Keep-Alive
----------------------------------------------------

My question is the following: Is there anyway to post HTTP commands using
the .Net Framework?

Thanks,
Isaac
Nov 16 '05 #1
1 1577


Isaac Martinez wrote:
Using network monitor I was able to sniff out the HTTP command that would
allow file deletion.
----------------------------------------------------
DELETE filename.txt
HTTP/1.1
Accept-Language: en-us
Destroy: NoUndelete
Translate: f
User-Agent: Microsoft Data Access Internet Publishing Provider DAV 1.1
Host: 192.168.XXX.XXX
Content-Length: 0
Connection: Keep-Alive
----------------------------------------------------

My question is the following: Is there anyway to post HTTP commands using
the .Net Framework?


Look at HttpWebRequest (in System.Net), it has a property called Method
that you can set to "DELETE". You usually create a HttpWebRequest with
HttpWebRequest httpRequest = (HttpWebRequest )
WebRequest.Crea te("http://www.example.com/dir/subdir/file.html");

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 16 '05 #2

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

Similar topics

4
9340
by: Mark Wilson CPU | last post by:
A colleague has written a prototype program in PHP, using a MySQL database. It's a relatively simple app, with a restricted set of mysql commands used (see below). The MySQL DB is being replaced with an Oracle DB (same schema). My plan 1) globally replace the few mysql commands with intermediate equivalents (such as myDB_connect for mysql_connect) 2) those central functions would then (for now) call the original mysql function to prove...
4
2448
by: Avi Kak | last post by:
Is there a Python function in any of the standard-distribution modules that does what the backticks do in Perl? I want to run an external command and I'd like its output to be captured directly in my Python script in the form of a string object. The function os.system() or any of the
3
24689
by: baileystuff | last post by:
I have an issue where I have three Cases that SHOULD act the same but don't. If you look at the code below you will see that the general premise is to open a MSWord template and then use SendKey commands to get it to save the file using a new name (NewFName is assigned earlier in the code). A couple of issues to keep in mind. These are MailMerge templates that are attached to a Text Deliminted File (a separate one for each Case, i.e....
1
2685
by: xtra | last post by:
Hi Folk I have written a module that allows you to type a bunch of commands in the immediate window, for quick access to information when you are creating VB code. Here it is, it may be helpful to you (I find it pretty fast and friendly).... Some of it is specific to my database (I left out many as well which were too specific), so you will have to rewrite it for yours, but you may find it useful.... Any questions, please ask. Typing...
4
2481
by: Bob Badger | last post by:
Hi, Simple question (although I guess with a complicated answer). Is HTTP an async protocol? For instance, if I send a message to a c# webservice via http what is the protocol actually doing? Thanks in advance Steffan
8
1846
by: Joanna Carter [TeamB] | last post by:
Hi Folks I am just trying to get my head around whether I can use a single SQLConnection for the life of the application or whether I should create it only when needed. I want to create cached SQLCommand objects that are then prepared to reduce subsequent execution time, but these can't be prepared unless their Connection property has been set.
13
1890
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= | last post by:
I am using VS2005. I created a Windows Appication project. Inside the Server Explorer, I created a new SQLExpress database, and then created a new table. I added the rows, making my first row an integer, and setting the identity property to true. I set that row to be my primary key. I then added a dataset, and added my table to the dataset. When I configure the table, I have no Update or Delete commands, even though the wizard has the...
6
4056
by: Peted | last post by:
Hi wondering what is the best way to do this Need a user to click a button, that sends 3 or 4 string based commands via a TCP/ip socket link I can connect to the ip device no problems, am using indy sockets, and can send information ok
0
1267
by: Astan Chee | last post by:
Hi, Im trying to implement the logic from http://www.hypothetic.org/docs/msn/general/http_connections.php to a simple python code using urllib2 and some parts of urllib. Im behind a http proxy that requires authentication that is why Im using urllib2. Im asking for help on how to send commands in a body of a HTTP before requesting for response. What am I doing wrong? I only get the response from the server but my commands never seem to be...
0
9647
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
10357
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
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
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
5397
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...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
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
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.