Search code examples
asp.net-mvcasp.net-mvc-5

Asp.Net MVC Unique id per request


In our MVC 5 site, no session, we need to get/generate a unique ID per request. THhis will be used as an ID for logging all activity in the request.

Is there a way to assign/get a value to a Request to enable this?


Solution

  • Add it to the request item collection odetocode.com/articles/111.aspx

    Guid.NewGuid()
    

    Will generate a unique id.

    http://msdn.microsoft.com/en-us/library/system.guid.newguid(v=vs.110).aspx