Click here to Skip to main content
15,890,882 members
Home / Discussions / C#
   

C#

 
AnswerRe: how can i scann image from scanner in C# Pin
lukeer22-Feb-12 2:17
lukeer22-Feb-12 2:17 
Questiontrouble in connecting from C# to Postgre SQL. Pin
hellono121-Feb-12 20:46
hellono121-Feb-12 20:46 
AnswerRe: trouble in connecting from C# to Postgre SQL. Pin
BobJanova21-Feb-12 21:42
BobJanova21-Feb-12 21:42 
QuestionIntegration of .NET with retail billing machine Pin
tahernd21-Feb-12 19:14
tahernd21-Feb-12 19:14 
AnswerRe: Integration of .NET with retail billing machine Pin
Richard MacCutchan21-Feb-12 21:24
mveRichard MacCutchan21-Feb-12 21:24 
AnswerRe: Integration of .NET with retail billing machine Pin
Mycroft Holmes21-Feb-12 21:39
professionalMycroft Holmes21-Feb-12 21:39 
GeneralRe: Integration of .NET with retail billing machine Pin
tahernd22-Feb-12 0:26
tahernd22-Feb-12 0:26 
QuestionAny difference between Console App and Windows Service for HttpWebRequest..? [Solved] Pin
Paladin200021-Feb-12 6:38
Paladin200021-Feb-12 6:38 
I am using an HTTP-based API to a 3rd-party service. Its usage involves two steps: POSTing a login command (which saves the session in a cookie), then issuing another command. I have tested this successfully in a console app, but when I try to use it in a (production) Windows service I am getting a 407 Proxy error back.

Is there some difference between them regarding HttpWebRequests? I don't believe so but I'm scratching my head here.

C#
private WebResponse webPOST(string URLextension, string Parameters)
{
    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(BASE_URL + URLextension);
    request.ContentType = "application/x-www-form-urlencoded";
    request.Method = "POST";
    request.Headers.Add("X-Requested-With: C# Interface");
    request.CookieContainer = _cookieJar;
    request.Timeout = 3600000;  //1 HOUR TIMEOUT
    if (_proxy != string.Empty)
    {
        request.Proxy = new System.Net.WebProxy(_proxy, false);
        request.Proxy.Credentials = new 
            NetworkCredential(_proxyUser.ConvertToUnsecureString(), _proxyPass.ConvertToUnsecureString());
    }
    byte[] buffer = Encoding.GetEncoding("UTF-8").GetBytes(Parameters);
    Stream reqstr = request.GetRequestStream();
    reqstr.Write(buffer, 0, buffer.Length);
    reqstr.Close();
    return request.GetResponse();
}


The _cookieJar is a private property used to store the cookie generated by login. Both the login command and the "objective" command are issued via this private method, and the entire thing works with no errors in a console app.
AnswerRe: Any difference between Console App and Windows Service for HttpWebRequest..? Pin
jschell21-Feb-12 9:41
jschell21-Feb-12 9:41 
GeneralRe: Any difference between Console App and Windows Service for HttpWebRequest..? Pin
Paladin200021-Feb-12 10:10
Paladin200021-Feb-12 10:10 
AnswerRe: Any difference between Console App and Windows Service for HttpWebRequest..? Pin
Dave Kreskowiak21-Feb-12 15:08
mveDave Kreskowiak21-Feb-12 15:08 
GeneralRe: Any difference between Console App and Windows Service for HttpWebRequest..? Pin
Paladin200022-Feb-12 3:34
Paladin200022-Feb-12 3:34 
AnswerRe: Any difference between Console App and Windows Service for HttpWebRequest..? [Eureka!] Pin
Paladin200022-Feb-12 10:40
Paladin200022-Feb-12 10:40 
GeneralRe: Any difference between Console App and Windows Service for HttpWebRequest..? [Eureka!] Pin
jschell22-Feb-12 11:35
jschell22-Feb-12 11:35 
QuestionVisual Studio - Could not load file or assembly 'Microsoft MSXML' Pin
Michael Breeden21-Feb-12 6:27
Michael Breeden21-Feb-12 6:27 
AnswerRe: Visual Studio - Could not load file or assembly 'Microsoft MSXML' Pin
Eddy Vluggen21-Feb-12 10:15
professionalEddy Vluggen21-Feb-12 10:15 
GeneralNo help there Pin
Michael Breeden21-Feb-12 10:40
Michael Breeden21-Feb-12 10:40 
GeneralRe: No help there Pin
Eddy Vluggen21-Feb-12 10:59
professionalEddy Vluggen21-Feb-12 10:59 
AnswerWell, I solved it. Just install VS 2010 Express Pin
Michael Breeden21-Feb-12 15:42
Michael Breeden21-Feb-12 15:42 
QuestionClearing ZedGraph curves Pin
DerecL21-Feb-12 6:23
DerecL21-Feb-12 6:23 
AnswerRe: Clearing ZedGraph curves Pin
Eddy Vluggen21-Feb-12 10:18
professionalEddy Vluggen21-Feb-12 10:18 
Questionhot to get processor ID in C# Pin
venkateshsingaluri21-Feb-12 4:53
venkateshsingaluri21-Feb-12 4:53 
AnswerRe: hot to get processor ID in C# Pin
ProEnggSoft21-Feb-12 5:08
ProEnggSoft21-Feb-12 5:08 
AnswerRe: hot to get processor ID in C# Pin
Dave Kreskowiak21-Feb-12 5:43
mveDave Kreskowiak21-Feb-12 5:43 
AnswerRe: hot to get processor ID in C# Pin
Smart Arab21-Feb-12 6:50
Smart Arab21-Feb-12 6:50 

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.