Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4117562
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:51:01+00:00 2026-05-20T22:51:01+00:00

I have an aspx website and I’d like to upload a file to it.

  • 0

I have an aspx website and I’d like to upload a file to it. The file is being processed later, so I need to support some extra information with it.

This is the website I have to far:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Upload.aspx.cs" Inherits="ABC.Web.Upload" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="Form1" method="post" enctype="multipart/form-data" runat="server">
    <input type="file" id="File1" name="File1" runat="server" />
    <input type="text" id="FileId" name="FileId" runat="server" />
    <input type="submit" id="Submit1" value="Upload" runat="server" />
    </form>
</body>
</html>

This (and the code behind) works very well when using a browser and clicking through the form. But I want to upload the file using the WebClient from C# code. I don’t have to use the WebClient, so I am open to other suggestions. I can also modify the upload.aspx to suit me, there is no requirement that it works from a browser, but this is the only example I’ve got working.

Looking at fiddler (I just started using it, so I probably have missed it) I could not figure out how I would create such a request from code.

At the moment when using the WebClient I am specifying the address and the local filename. I have a breakpoint in the code behind in my website but the File1 and FileId are not set (as expected).

How do I have to modify the website and how do I have to use the WebClient to get the upload working?

EDIT: Just found out about the Request.Files, that will give me the file, but how about the other fields?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:51:01+00:00Added an answer on May 20, 2026 at 10:51 pm

    Many ways to do this the easiest would be to set File1 and Field as part of the query string in your WebClient. Then on the server side you should have these values in the Request object.

    myQueryStringCollection.Add("File1",yourFile1);
    myQueryStringCollection.Add("FileId",myFileId); 
    myWebClient.QueryString = myQueryStringCollection;
    

    Note, don’t do this if you are trying to keep this information secure and are using ssl. In which case add it to the form data being posted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within my Website project, I have some aspx pages, javascript files, and a custom
I have a URL which looks like this: http://www.website.co.uk/en-us/aboutus/thegroup/test.aspx I have a UL LI
I have around 40 aspx pages in my website. I want to use a
This is what I have in the aspx page: <head runat=server> <title>Website - <asp:ContentPlaceHolder
I have a asp.net website, there is a searchResult.aspx, it runs a sql script
I have one aspx page with some controls. Also i have one DIV which
I have a website that is already completed in ASP.NET. I need to add
I have a template for a website, and I want to edit the aspx
I have created a website from File->new-> Web Site. i am trying to go
I have a WebSite project - ASPX, 4.0. In it I have a folder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.