Click here to Skip to main content
15,918,404 members
Home / Discussions / C#
   

C#

 
GeneralRe: Ahhhh! Pin
Mathew Hall3-Sep-05 22:14
Mathew Hall3-Sep-05 22:14 
QuestionHow to add Binary Resources Pin
Heinz_3-Sep-05 20:33
Heinz_3-Sep-05 20:33 
AnswerRe: How to add Binary Resources Pin
turbochimp4-Sep-05 16:34
turbochimp4-Sep-05 16:34 
GeneralRe: How to add Binary Resources Pin
Heinz_5-Sep-05 9:51
Heinz_5-Sep-05 9:51 
GeneralRe: How to add Binary Resources Pin
turbochimp6-Sep-05 11:21
turbochimp6-Sep-05 11:21 
GeneralRe: How to add Binary Resources Pin
Heinz_7-Sep-05 19:55
Heinz_7-Sep-05 19:55 
GeneralRe: How to add Binary Resources Pin
turbochimp7-Sep-05 20:43
turbochimp7-Sep-05 20:43 
GeneralRe: How to add Binary Resources Pin
Heinz_8-Sep-05 11:31
Heinz_8-Sep-05 11:31 
Questionplz help me Pin
Sayed Sajjad Raza Zaidi3-Sep-05 20:12
Sayed Sajjad Raza Zaidi3-Sep-05 20:12 
AnswerRe: plz help me Pin
Mohamad Al Husseiny4-Sep-05 10:14
Mohamad Al Husseiny4-Sep-05 10:14 
Questionparse string by using xml Pin
savage_3-Sep-05 13:50
savage_3-Sep-05 13:50 
AnswerRe: parse string by using xml Pin
Guffa3-Sep-05 15:11
Guffa3-Sep-05 15:11 
QuestionPlease Help:Marshaling Question?? Pin
E6AD3-Sep-05 12:51
E6AD3-Sep-05 12:51 
QuestionURGENTLY complicated Pin
malak nour3-Sep-05 12:03
malak nour3-Sep-05 12:03 
AnswerRe: URGENTLY complicated Pin
Judah Gabriel Himango3-Sep-05 12:26
sponsorJudah Gabriel Himango3-Sep-05 12:26 
Questionhelp regarding server monitoring Pin
vkas_in_guj3-Sep-05 10:10
vkas_in_guj3-Sep-05 10:10 
AnswerRe: help regarding server monitoring Pin
Dave Kreskowiak3-Sep-05 11:34
mveDave Kreskowiak3-Sep-05 11:34 
QuestionHow to Convert this in C# Pin
majidbhutta3-Sep-05 8:21
majidbhutta3-Sep-05 8:21 
Answer[Message Deleted] Pin
philip_cole3-Sep-05 9:18
philip_cole3-Sep-05 9:18 
AnswerRe: How to Convert this in C# Pin
philip_cole3-Sep-05 9:30
philip_cole3-Sep-05 9:30 
QuestionReflection Emit Pin
Yoyosch3-Sep-05 7:07
Yoyosch3-Sep-05 7:07 
AnswerRe: Reflection Emit Pin
if_mel_yes_else_no3-Sep-05 8:38
if_mel_yes_else_no3-Sep-05 8:38 
QuestionTime change events Pin
monrobot133-Sep-05 6:25
monrobot133-Sep-05 6:25 
AnswerRe: Time change events Pin
if_mel_yes_else_no3-Sep-05 8:29
if_mel_yes_else_no3-Sep-05 8:29 
QuestionHttpWebRequest Timeout Problem Pin
surfman193-Sep-05 4:30
surfman193-Sep-05 4:30 
hi,
i have a problem when i send a HttpRequest!
first i send a request to get the session_id than a login request and after that a other request....
after that i begin with the request for session_id and than the problem arise when i send the login request...
i get a timeout error when i call request.GetRequestStream (); by why!?!

cu

<br />
request for session id:<br />
-----------------------<br />
HttpWebRequest get_request = (HttpWebRequest)WebRequest.Create("https://www.myzone.at/webkeeper/Controller");<br />
get_request.CookieContainer = new CookieContainer();<br />
      <br />
HttpWebResponse get_response = (HttpWebResponse) get_request.GetResponse();<br />
get_response.Cookies = get_request.CookieContainer.GetCookies(get_request.RequestUri);<br />
<br />
String sessionid = "Cookie: ";<br />
sessionid += get_response.Cookies[0].ToString();<br />
<br />
login request:<br />
--------------<br />
HttpRequestResponse login_request = new HttpRequestResponse("https://www.myzone.at/webkeeper/Controller", "POST", "action=login&login=Anmelden&brand=myzone&username=xxxxxx&password=xxxxxxb&x=83&y=13");<br />
login_request.SESSION_ID = sessionid;<br />
login_request.SendRequest();<br />
<br />
<br />
<br />
sendrequest method:<br />
-----------------------------------------<br />
public string SendRequest()<br />
{<br />
    string responseFromServer="";<br />
<br />
    try<br />
    {<br />
        if((RequestMethod.ToUpper() != "GET") && (RequestMethod.ToUpper() != "POST"))<br />
            throw new WebException(RequestMethod+ " is not a valid method.  Use GET or POST.");<br />
<br />
        // Create a request using a URL that can receive a post. <br />
        HttpWebRequest request = (HttpWebRequest) WebRequest.Create(URL);<br />
        // Set the Method property of the request to POST.<br />
                request.Method = RequestMethod;<br />
        // Set the sessionid to the Header<br />
        request.Headers.Add(SessionId);<br />
<br />
        // check if asked to do a POST request, if so then modify <br />
        // the original request as it defaults to a GET method<br />
        if(RequestMethod.ToUpper()=="POST") <br />
        {<br />
            // Create POST data and convert it to a byte array.<br />
            byte[] byteArray = Encoding.UTF8.GetBytes (PostData);<br />
                    <br />
            // Set the ContentType property of the WebRequest.<br />
            request.ContentType = "application/x-www-form-urlencoded";<br />
                    <br />
            // Set the ContentLength property of the WebRequest.<br />
            request.ContentLength = byteArray.Length;<br />
                    <br />
            // Get the request stream.<br />
            Stream requestStream = request.GetRequestStream ();     <------------ here arise the timeout when i send the 2nd login request...<br />
                    <br />
            // Write the data to the request stream.<br />
            requestStream.Write (byteArray, 0, byteArray.Length);<br />
            // Close the Stream object.<br />
            requestStream.Close ();<br />
        }<br />
                <br />
        // Get the response.<br />
        HttpWebResponse response = (HttpWebResponse) request.GetResponse();<br />
        // Get the stream containing content returned by the server.<br />
        Stream dataStream = response.GetResponseStream ();<br />
        // Open the stream using a StreamReader for easy access.<br />
        StreamReader reader = new StreamReader (dataStream);<br />
        // Read the content.<br />
        responseFromServer = "HTTP/" + response.ProtocolVersion + " " + response.StatusDescription + " ";<br />
        responseFromServer += response.Headers.ToString();<br />
<br />
        // Clean up the streams.<br />
        reader.Close ();<br />
        dataStream.Close ();<br />
        response.Close ();<br />
    }<br />
<br />
    catch (WebException e)<br />
    {<br />
        throw CatchHttpExceptions(responseFromServer = e.Message);<br />
    }<br />
    catch (Exception e)<br />
    {<br />
        throw new Exception(responseFromServer = e.Message);<br />
    }<br />
<br />
    return responseFromServer;<br />
}<br />

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.