Click here to Skip to main content
16,020,565 members
Home / Discussions / Windows Forms
   

Windows Forms

 
QuestionDrag and Drop Into Word Pin
Chadwick Posey20-May-09 8:04
Chadwick Posey20-May-09 8:04 
AnswerRe: Drag and Drop Into Word Pin
Chadwick Posey22-May-09 7:44
Chadwick Posey22-May-09 7:44 
QuestionMultiple Context Menu visibility issue Pin
TyrionTheImp20-May-09 7:21
TyrionTheImp20-May-09 7:21 
QuestionHow to use windows application with in the LAN Pin
Rakhe19-May-09 22:03
Rakhe19-May-09 22:03 
AnswerRe: How to use windows application with in the LAN Pin
EliottA20-May-09 2:44
EliottA20-May-09 2:44 
Questionhow to use an windows application in lan? Pin
Rakhe19-May-09 21:35
Rakhe19-May-09 21:35 
AnswerRe: how to use an windows application in lan? Pin
Mycroft Holmes23-May-09 17:49
professionalMycroft Holmes23-May-09 17:49 
QuestionC# console application for web file download gets 401 Pin
Mike Devenney19-May-09 9:26
Mike Devenney19-May-09 9:26 
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. Cross posted in C# and Windows-Forms forums.

Mike Devenney

AnswerRe: C# console application for web file download gets 401 Pin
bc_sridhar14-Jan-10 4:16
bc_sridhar14-Jan-10 4:16 
QuestionTooltip in Datagrid 1.1 Pin
mistryshailesh18-May-09 18:43
mistryshailesh18-May-09 18:43 
Question"Assembly Resource File" in Visual Studio 2008 Pin
bigcivilmelon18-May-09 12:51
bigcivilmelon18-May-09 12:51 
Questionsmart logger window Pin
IWannaTalk18-May-09 3:53
IWannaTalk18-May-09 3:53 
AnswerRe: smart logger window Pin
Luc Pattyn18-May-09 5:11
sitebuilderLuc Pattyn18-May-09 5:11 
GeneralRe: smart logger window Pin
IWannaTalk18-May-09 10:57
IWannaTalk18-May-09 10:57 
GeneralRe: smart logger window Pin
EliottA19-May-09 2:45
EliottA19-May-09 2:45 
Questionpassing value one from to another form Pin
grandhisrinivas17-May-09 20:13
grandhisrinivas17-May-09 20:13 
AnswerRe: passing value one from to another form Pin
Mycroft Holmes17-May-09 21:58
professionalMycroft Holmes17-May-09 21:58 
GeneralRe: passing value one from to another form Pin
EliottA19-May-09 2:47
EliottA19-May-09 2:47 
GeneralRe: passing value one from to another form Pin
Mycroft Holmes19-May-09 12:56
professionalMycroft Holmes19-May-09 12:56 
GeneralRe: passing value one from to another form Pin
grandhisrinivas19-May-09 22:42
grandhisrinivas19-May-09 22:42 
GeneralRe: passing value one from to another form Pin
Mycroft Holmes19-May-09 23:01
professionalMycroft Holmes19-May-09 23:01 
QuestionAdding a Button to the TextBox Pin
sunnytyra17-May-09 16:11
sunnytyra17-May-09 16:11 
AnswerRe: Adding a Button to the TextBox Pin
Mycroft Holmes17-May-09 21:56
professionalMycroft Holmes17-May-09 21:56 
GeneralRe: Adding a Button to the TextBox Pin
sunnytyra27-Jul-09 20:30
sunnytyra27-Jul-09 20:30 
GeneralRe: Adding a Button to the TextBox Pin
Mycroft Holmes27-Jul-09 21:14
professionalMycroft Holmes27-Jul-09 21:14 

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.