locked
MSDN documentation - http://msdn.microsoft.com/en-us/library/system.net.http.httprequestmessageextensions.getcorrelationid%28v=vs.118%29.aspx RRS feed

  • Question

  • Hi,

    According to the MSDN documentation for HttpRequestMessageExtensions.GetCorrelationId Method, the intended behavior of the method is get a new guid for new http request. We have observed plenty of duplicate Identifiers generated from the GetCorrelationId method.

    Please let me know if the documentation is poor to highlight the usage or is it a bug?

    Thanks

    Wednesday, January 14, 2015 1:40 AM

Answers

  • Hello sevenhills,

    >> the intended behavior of the method is get a new guid for new http request.

    After checking the link you provided, I created a test, it performs this behavior which seems to be your excepted, and this is the tested code:

    HttpRequestMessage request1 = new HttpRequestMessage(HttpMethod.Get, "https://www.google.com.hk/");
    
                    var guid1 = request1.GetCorrelationId();
    
                    HttpRequestMessage request2 = new HttpRequestMessage(HttpMethod.Get, "https://www.google.com.hk/");
    
                    var guid2 = request2.GetCorrelationId();
    
                    if (guid1 == guid2)
    
                    {
    
                        //if run into here, the guids are same
    
                    }
    
                    else
    
                    {
    
                        //if run into here, the guids are different
    
                    }

    It will always run into the else statement in my machine. You could have a try with this demo to see if it works for you.

    By the way, since this method is related with web applications, I suggest you could post web related issue to:

    http://forums.asp.net/

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Fred Bao Friday, January 23, 2015 7:05 AM
    • Marked as answer by Fred Bao Friday, January 23, 2015 7:05 AM
    Wednesday, January 14, 2015 11:19 AM

All replies

  • Hello sevenhills,

    >> the intended behavior of the method is get a new guid for new http request.

    After checking the link you provided, I created a test, it performs this behavior which seems to be your excepted, and this is the tested code:

    HttpRequestMessage request1 = new HttpRequestMessage(HttpMethod.Get, "https://www.google.com.hk/");
    
                    var guid1 = request1.GetCorrelationId();
    
                    HttpRequestMessage request2 = new HttpRequestMessage(HttpMethod.Get, "https://www.google.com.hk/");
    
                    var guid2 = request2.GetCorrelationId();
    
                    if (guid1 == guid2)
    
                    {
    
                        //if run into here, the guids are same
    
                    }
    
                    else
    
                    {
    
                        //if run into here, the guids are different
    
                    }

    It will always run into the else statement in my machine. You could have a try with this demo to see if it works for you.

    By the way, since this method is related with web applications, I suggest you could post web related issue to:

    http://forums.asp.net/

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Fred Bao Friday, January 23, 2015 7:05 AM
    • Marked as answer by Fred Bao Friday, January 23, 2015 7:05 AM
    Wednesday, January 14, 2015 11:19 AM
  • This issue is happening for me as well. Please find my question here 

    JJ

    Wednesday, August 8, 2018 2:25 PM