Archive

Author Archive

One of the best online resource to Learn IT Skills Pluralsight

November 25, 2023 Leave a comment

Impact-Site-Verification: 294dbebc-38ab-452d-92bd-67606e5c6f7c

Categories: General

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!

Amazon

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

How To Lower Cholesterol Naturally

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/

Using CSS to Style a RadioButtonList Control in ASP.NET

August 13, 2015 2 comments

Hi,
I wanted to give styling to Radio list box.
Also wanted to highlight the radio span after selection.
Sharing the code for your reference:

CSS code:
.radioboxlist radioboxlistStyle
{
font-size:x-large;
padding-right: 20px;
}
.radioboxlist label {
color: #3E3928;
background-color:#E8E5D4;
padding-left: 6px;
padding-right: 16px;
padding-top: 2px;
padding-bottom: 2px;
border: 1px solid #AAAAAA;
white-space: nowrap;
clear: left;
margin-right: 10px;
margin-left: 10px;
}
.radioboxlist label:hover
{
color: #CC3300;
background: #D1CFC2;
}
input:checked + label {
color: #CC3300;
background: #D1CFC2;
}

In asp.net Server code:

<asp:RadioButtonList ID="RadioButtonListGarment" runat="server" CssClass="radioboxlist">

Categories: ASP.net C#, tricks

SQL SERVER – How To Delete Duplicate Records – Based on Rows

August 11, 2015 Leave a comment

Heree is handy code I got from sqlauthority.com, for deleting the duplicate records from table.
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3)

Where DuplicateColumn1,DuplicateColumn2 etc are the columns on which you are checking for duplicate constraints.

Categories: MS Sql, tricks