Click here to Skip to main content
15,917,061 members
Home / Discussions / C#
   

C#

 
QuestionUmm...wow...request from one of our IBM guys - He needs to send an EBCDIC blob(not converted to ASCII) to be consumed directly by a C# app Pin
Alaric_19-May-09 9:25
professionalAlaric_19-May-09 9:25 
GeneralRe: Umm...wow...request from one of our IBM guys [modified] Pin
led mike19-May-09 10:02
led mike19-May-09 10:02 
GeneralRe: Umm...wow...request from one of our IBM guys Pin
Alaric_19-May-09 10:20
professionalAlaric_19-May-09 10:20 
GeneralRe: Umm...wow...request from one of our IBM guys Pin
led mike19-May-09 11:54
led mike19-May-09 11:54 
AnswerRe: Umm...wow...request from one of our IBM guys - He needs to send an EBCDIC blob(not converted to ASCII) to be consumed directly by a C# app Pin
Luc Pattyn19-May-09 14:07
sitebuilderLuc Pattyn19-May-09 14:07 
AnswerRe: Umm...wow...request from one of our IBM guys - He needs to send an EBCDIC blob(not converted to ASCII) to be consumed directly by a C# app Pin
PIEBALDconsult19-May-09 15:20
mvePIEBALDconsult19-May-09 15:20 
AnswerRe: Umm...wow...request from one of our IBM guys - He needs to send an EBCDIC blob(not converted to ASCII) to be consumed directly by a C# app Pin
Moreno Airoldi20-May-09 1:05
Moreno Airoldi20-May-09 1:05 
QuestionWeb file download from C# console application gets 401 Pin
Mike Devenney19-May-09 9:22
Mike Devenney19-May-09 9:22 
I've been working on automating a file download from the swift.com website. I don't know if this makes a difference but the site uses the Apache webserver. The documentation from SWIFT stresses that they're using the Apache HTTP Client Library, but their sample code is in Java, so that might be why. I assumed that a web request is a web request, regardless of the library you use to create it, but here I am asking for help, so maybe my assumption is incorrect. I've included a portion of the code I wrote to download the file.

...
WebRequest myReq = WebRequest.Create(URL);
string username = "me@mydomain.com";
string password = "myPassword";
string usernamePassword = username + ":" + password;
CredentialCache mycache = new CredentialCache();

mycache.Add(new Uri(URL), "Basic", new NetworkCredential(username, password, "swift.com"));
myReq.Credentials = mycache;
myReq.PreAuthenticate = true;
myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));
myReq.Proxy = WebProxy.GetDefaultProxy();
myReq.Proxy.Credentials = CredentialCache.DefaultCredentials;

<-- Error occurs on the next line: The remote server returned an error: (401) Unauthorized -->
WebResponse wr = myReq.GetResponse(); 
Stream receiveStream = wr.GetResponseStream();
StreamReader sr = new StreamReader(receiveStream, Encoding.UTF8);
StringBuilder bicFile = new StringBuilder();
...


Anyone care to shed some light on this for me? I've logged into the site using the credentials so I know I have them right.

Mike Devenney

AnswerRe: Web file download from C# console application gets 401 Pin
led mike19-May-09 10:13
led mike19-May-09 10:13 
AnswerRe: Web file download from C# console application gets 401 Pin
Noctris19-May-09 10:25
Noctris19-May-09 10:25 
GeneralRe: Web file download from C# console application gets 401 Pin
Baeltazor19-May-09 17:23
Baeltazor19-May-09 17:23 
GeneralRe: Web file download from C# console application gets 401 Pin
Mike Devenney20-May-09 5:04
Mike Devenney20-May-09 5:04 
QuestionRe: Web file download from C# console application gets 401 Pin
Mike Devenney20-May-09 7:21
Mike Devenney20-May-09 7:21 
Questionreferencing a control from a string Pin
Tom Wright19-May-09 9:17
Tom Wright19-May-09 9:17 
AnswerRe: referencing a control from a string [modified] Pin
Jimmanuel19-May-09 9:46
Jimmanuel19-May-09 9:46 
GeneralRe: referencing a control from a string Pin
Tom Wright19-May-09 10:25
Tom Wright19-May-09 10:25 
GeneralRe: referencing a control from a string Pin
Tom Wright19-May-09 10:27
Tom Wright19-May-09 10:27 
GeneralRe: referencing a control from a string Pin
Jimmanuel19-May-09 10:38
Jimmanuel19-May-09 10:38 
GeneralRe: referencing a control from a string Pin
Tom Wright19-May-09 10:40
Tom Wright19-May-09 10:40 
GeneralRe: referencing a control from a string Pin
Jimmanuel19-May-09 11:00
Jimmanuel19-May-09 11:00 
GeneralRe: referencing a control from a string Pin
Jimmanuel19-May-09 11:17
Jimmanuel19-May-09 11:17 
AnswerRe: referencing a control from a string [modified] Pin
xcorporation19-May-09 11:05
xcorporation19-May-09 11:05 
GeneralRe: referencing a control from a string Pin
Tom Wright20-May-09 8:45
Tom Wright20-May-09 8:45 
QuestionRegex question Pin
Harvey Saayman19-May-09 8:46
Harvey Saayman19-May-09 8:46 
AnswerRe: Regex question Pin
led mike19-May-09 8:54
led mike19-May-09 8:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.