Cannot access a disposed object. ‘System.Net.Http.StringContent’ While having retry logic.

Hi, I faced this scenario today when I was trying to make an HttpPost call using a retry logic wherein I was getting an ObjectDisposedException while trying to retry for the first time. Exception Message: Cannot access a disposed object. Object name: ‘System.Net.Http.StringContent’ My calling code was something like this. var httpContent = GetHttpContent(); retryPolicy.ExecuteWithRetry(async […]

Getting a machine name of logged in user in

Hi, I recently encountered this scenario and thought of blogging about it. To get the machine name of the logged in user, you can use the “GetHostEntry()” method provided in System.Net.Dns class. GetHostEntry takes a string as parameter and it is the hostname or address of the machine whose entry we need to get. So […]

‘yield’ Keyword in C#

Hi, This post is mainly about the ‘yield’ keyword provided in C#. I never really got a chance to use this keyword until now. So thought I would just blog about it. This blog is not of my own writing; I would say it is rather a re-blogging of a discussion about the keyword in […]

Accessing impersonated user’s details from code behind in C#

Hi all, Many of us might know that in web development, config files play a very important role. Reading config file entries in a code-behind file is a very common thing in web development. Config entries are stored in web.config file in the <appSettings> tag and can be accessed using System.Configuration.ConfigurationManager.AppSettings[“keyName”]; But there might be […]