473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

HTTP Request

I got a problem with HTTP Requests.

Here is the POST Request I want to get the respond to:
<div id="tabs-2">
<div class="form" id="upload_form">
<p>Please select a container file to upload.</p>
<form action="/decrypt/upload" method="post" enctype="multipart/form-data">
<fieldset>
<p class="formrow file_upload">
<label for="dlcfile">Container File</label>
<input type="file" class="file_field" name="dlcfile" id="dlcfile"/>
<input type="text" value="Click here to select a file..." class="file_overlay" />
</p>
<p class="buttonrow"><button type="submit">Submit »</button></p>
</fieldset>
</form>
</div>
</div>

And here is my C# Code
public static void decryptContainer(string path)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://dcrypt.it/decrypt/upload");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.Accept = "Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";


using (StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII))
{
writer.Write("dlcfile=" + path);
}

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
Console.WriteLine(reader.ReadToEnd());
}
}

I get an unhandled WebException, and I think it´s because I submit a string as path, but the script wants a "file", but I dont know how to submit it. Can someone help me with that?
Oct 13 '11 #1
0 1104

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Fran?ois-Xavier Testard-Vaillant | last post by:
In a Perl script I want to send several http requests WITHOUT waiting for the remote servers answer (i.e. just triggering http requests) and without having to create lots of processes... Thanks...
1
by: Sure | last post by:
Hello All, I want to update a form using the LWP & HTTP method. It was working fine when I am updating the values like this $ua = LWP::UserAgent->new; $url...
2
by: Robert Oschler | last post by:
I have an IMG element that I've been using to send messages back to my server whenever certain item option choices are made by a visitor. I send each message by forming a URL with various search...
5
by: Henrik | last post by:
Hi, I am trying to read some industrial webservers using the HTTP/CGI webequest like this: wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string); mwst = (HttpWebResponse wrs.GetResponse();...
1
by: Kueishiong Tu | last post by:
I have a .net window form application but I have to get data from various web sites. How do I make Http request (preferrably via post method) from a window form to get the data from those web...
1
by: omantawy | last post by:
Hi, I have some legacy ASP web applications that use an unmanaged COM component to connect to a third party application. The third part application has moved to the managed code in the current...
4
by: AviCoh | last post by:
Hi, Let me start with the question and then describe my case : Is there a way to read the raw contents of an HTTP request in PHP as a stream (i.e. not get it all at once from Apache) ? In my...
1
by: nkg1234567 | last post by:
I'm trying to extract HTML from a website in the form of a string, and then I want to extract particular elements from the string using the substr function: here is some sample code that I have thus...
5
by: rpjanaka | last post by:
Hi all, I am using AJAX to submit a data from a web page, it is properly working on the local host (when test with the local machine it is ok).also when access from another machine the pages are...
7
by: samthemist | last post by:
#/usr/bin/perl -w use LWP::UserAgent; use Time::HiRes qw(gettimeofday); #use Crypt::SSLeay; use strict; print "Enter URL to Time GET request for... "; my $host=<STDIN>; chomp $host;
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.