Log4net integration

January 13, 2017 Leave a comment

Hi folks,
I was integarting log4net library which is amazing for logging in .net Applications.

One issue i run into worth mentioning, I got following error
“log4net:ERROR Failed to find configuration section ‘log4net’ in the application’s .config file. Check your .config file for the and elements. The configuration section should look like: <section name="log4net""

When I used following declartion , issue resolved:

private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

Regards

Categories: ASP.net C#, Bugs, tricks

How do you do Impersonation in .NET?

September 30, 2016 Leave a comment

WindowsIdentity.Impersonate Method

Stackoverflow

MSDN

Categories: General

Nearbuy Discounted Coupons

August 13, 2016 Leave a comment

Hi,

We don’t want to span user with lot of unnecessary information 🙂 but save their time by displaying active Nearbuy discounted coupons & Nearbuy Promo code.

Support us by buying from following Links.

Following coupon(s) will give you 10% discount(Only One time)

SAMSUNG10
CGURU10
dekho10
crani10
CD15

 

Following coupon(s) will give you 5% discount

BULK5

Hope it will save your time & money.
Support us by buying from above Links.
Enjoy saving!

Control cholesterol naturally

October 8, 2015 Leave a comment

Food you can include in daily diet to control cholesterol naturally:

• Dark chocolate
• Avocados, avocado oil
• Red wine
• Green Tea
• almonds walnuts pista
• barley, oatmeal
• banana or apple
• fish (bake or grill)
• Olive oil
• soy milk, tofu
• bean, lentils
• pear, apple, oranges, berries
• eggplant, bhindi
• drink 2-3 ltrs of water (warm)

Ref: http://www.prevention.com/health/health-concerns/how-lower-cholesterol-naturally
https://www.pritikin.com/your-health/health-benefits/lower-cholesterol/1468-7-tips-for-improving-your-ldl-cholesterol.html

Categories: Food, fun, General, tricks

ASP.NET HttpWebRequest POST returns “The remote server returned an error: (405) Method Not Allowed.”

October 5, 2015 Leave a comment

I was facing issue in redirection in ASP.NET from SSO(Single Sign On) :

The IIS server produces the error for;
http://externalsite.com/WebSite
… but is happy with;

http://externalsite.com/WebSite/
http://externalsite.com/WebSite/Default.aspx

Reference: http://stackoverflow.com/questions/7651426/asp-net-httpwebrequest-post-returns-the-remote-server-returned-an-error-405

Categories: General

Find a Windows Process Name by Process ID

September 12, 2015 Leave a comment

I come across an issue where my Apache process id default port was used by another process with ID 3432.

If you need to find the process name in Windows :

1. Go to Task manager
2. Click “Process” tab
3. Click Menu “View” and Select “Select Column” option
2. Select the “PID” option.

If you don’t know even the process ID which is conflicting your current process, then
1. Go to command prompt
2. type command: netstat -ano => It will list all all listening portswith the process ids.

Hope it may help few!

Categories: General

Store and Reading connection string in web.config

August 14, 2015 Leave a comment

Handy Tips for freshers:
Connection string in .NET 3.5 (and above) config file:
Do not use appsettings in web.config. Instead use the connectionStrings section in web.config.

<add name="myConnectionString" connectionString="server=\SQLEXPRESS;database=myDb;uid=myUser;password=myPass;" />

To read/access the connection string into your code, use the ConfigurationManager class.
string connStr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;

Always store the connection string in a config file.
I saw many freshers save connection string on page(Hard Coding) or in session, Never be among them.

Connection string in .NET 2.0 config file
In the appSettings location, add a key named whatever you like to reference your connection string to.


To read the connection string from code, use the ConfigurationSettings class.
string connStr = ConfigurationSettings.AppSettings("myConnectionString");

Hope this will help few!

Ref: https://www.connectionstrings.com/store-connection-string-in-webconfig/