링크 : http://technet.rapaport.com/Info/LotUpload/SampleCode/WebClient_string.aspx 

 


string UploadCSVString = @"StockNumber,Shape,Weight,Color,Clarity" +

    Environment.NewLine + "1234Eli,Round,2.0,F,VVS1"; //CSV forma


string URLAuth = "https://technet.rapaport.com/HTTP/Authenticate.aspx";

WebClient webClient = new WebClient();


NameValueCollection formData = new NameValueCollection();

formData["Username"] = "myUser";

formData["Password"] = "myPassword";


byte[] responseBytes = webClient.UploadValues(URLAuth, "POST", formData);

string ResultAuthTicket = Encoding.UTF8.GetString(responseBytes);


webClient.Dispose();

string URL = "http://technet.rapaport.com/HTTP/Upload/Upload.aspx?Method=string";

formData.Clear();

formData["ticket"] = ResultAuthTicket;

formData["UploadCSVString"] = UploadCSVString;

formData["ReplaceAll"] = "false";


responseBytes = webClient.UploadValues(URL, "POST", formData);

string Result = Encoding.UTF8.GetString(responseBytes);



저작자 표시 비영리 변경 금지
신고
posted by 뚱2

.Net에서 WebBrowser 컨트롤을 임포트 해서 해결할수도 있고

 

좀더 아래 로우레벨로 내려가서 해결할수도 있습니다.

 

링크 (WebClient) : http://msdn.microsoft.com/ko-kr/library/system.net.webclient(v=vs.80).aspx

using System;
using System.Net;
using System.IO;

public class Test
{
    public static void Main (string[] args)
    {
        if (args == null || args.Length == 0)
        {
            throw new ApplicationException ("Specify the URI of the resource to retrieve.");
        }
        WebClient client = new WebClient ();

        // Add a user agent header in case the
        // requested URI contains a query.

        client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

        Stream data = client.OpenRead (args[0]);
        StreamReader reader = new StreamReader (data);
        string s = reader.ReadToEnd ();
        Console.WriteLine (s);
        data.Close ();
        reader.Close ();
    }
}

 

이벤트 (DownloadProgressChanged) : http://msdn.microsoft.com/ko-kr/library/system.net.webclient.downloadprogresschanged(v=vs.80).aspx 


링크 (WebRequest) : http://msdn.microsoft.com/ko-kr/library/system.net.webrequest(v=vs.95).aspx 

 

저작자 표시 비영리 변경 금지
신고

'.Net > .Net' 카테고리의 다른 글

[.Net] CodeDomProvider  (0) 2013.01.15
[.Net] Aspect Oriented Programming With .Net  (0) 2013.01.14
[.Net] 웹 자동화 구현 클래스  (0) 2013.01.09
[.Net] pinvoke.net  (0) 2013.01.07
[.Net] Windows 서비스 응용 프로그램  (0) 2012.12.07
[.Net] Zlib Wrapper  (0) 2012.05.22
posted by 뚱2