Wednesday, January 17, 2024

Get Web Request Error 500,400 Exception details in c#

WebException is a good approch to get the Real cause of 500 error,  


catch (WebException ex)

{
    using (var stream = ex.Response.GetResponseStream())
    using (var reader = new StreamReader(stream))
    {
        Console.WriteLine(reader.ReadToEnd());
    }
}
catch (Exception ex)
{
    // Something more serious happened
    // like for example you don't have network access
    // we cannot talk about a server exception here as
    // the server probably was never reached
}

Thursday, January 11, 2024

Some Key to Help for Sql Optimization

 Below having some command used to get/analysis the Sql Query for optimization.

Add Below list of command at top pf the Query with ON and at the end again reset with OFF

Ex: Set NoCount ON

--Query

Set NoCount OFF

----Set Of Commands--------

Set NoExec OFF

Set ParseOnly OFF

Set Concat_Null_Yields_NULL OFF

Set Arithabort OFF

--Set Showplan_Text OFF

Set Statistics Time OFF

Set Statistics IO OFF

Set NOCount OFF


-----Mainly Used below three command only-----

SET NOCOUNT ON

SET STATISTICS TIME ON

set statistics io on