Click here to Skip to main content
15,908,673 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have one project, and I've done some research to get the data out of the cloud quickly.
And I find amazon s3. I want to experiment with the empty console project and to integrate with my project.

How to solve start console application and write code.?

I write this code but dont write.How to create application and write code?

What I have tried:

using System;
using System.IO;

namespace ConsoleApplication1
        public partial class AmazonS3
            public object FileUpload1 { get; private set; }
            public object Response { get; private set; }

            protected void Page_Load(object sender, EventArgs e)


            protected void upload(string myBucketName, string accessKey ,
                string secretKey,)

                Stream st = FileUpload1.PostedFile.InputStream;

                string name = Path.GetFileName(FileUpload1.FileName);
                string myBucketName = "";
                string accessKey = "";
                string secretKey = "";
                bool a;
                AmazonUploader myUploader = new AmazonUploader();
                a = myUploader.sendMyFileToS3(st, accessKey, secretKey);
                if (a == true)
                    Response.Write("successfully uploaded");


Updated 10-Dec-18 9:30am
MadMyche 10-Dec-18 14:52pm    
You did not write this; I would go back to wherever you copied it from and get all of the code. You may also want to go through Console Apps 101
[no name] 10-Dec-18 15:04pm    
Yes it's true.I wanted to do it in the console application. I wanted to do it using the secret key and access key.I tried to edit it myself as a console and using the key.But ı dont run.How can I help you.

1 solution

Let us count the errors as to why this will not compile; much less run.

1- protected void Page_Load() is indicative of a web application.
-- If this was a console application it would be static void Main()

2- protected void upload() is empty.

3- The actual code within this class is not within a method. Best guess is it belongs in the upload method; but that is passing in values you are defining in this code. This is a compilation error

4- There are no references (e.g. using Amazon.S3; , so the class will not know what a new AmazonUploader(). This also is a compilation error
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900