How to get requesting page in C#

We can get requesting page url in C# to use below statement

We can also check the particular page
if (Request.UrlReferrer.OriginalString.IndexOf("confirmation.aspx") > -1)
// Code Here
We should include the namespace before that.
using System.Web;

Find iphone browser in c# code

I need to find the site has been opened in mobile browser version or not, if it opened in iphone browser, then i need to redirect other page. So i use UserAgent to find operating system details.

if (Request.UserAgent.ToLower().Contains("iphone") == true)

to get table names which are referenced by given table

Use this function to get table name which are referenced as foreign key by  given table's primary key

I want to find out that table names in database, a primary key of a table that referenced foreign key of another tables.

Here i have to pass the main table name and find out the tables the primary key of main table referenced the foreign key of another tables.

CREATE FUNCTION [dbo].[getForignkeyTblName1](@tblname varchar(50))
RETURNS @tbl TABLE(tblnames varchar(50))
declare @objid int,@objname nvarchar(776),@result varchar(50)
INSERT INTO @tbl SELECT b.Name FROM sys.foreign_keys a
INNER JOIN sys.tables b
ON a.parent_object_id =b.object_id
 WHERE a.referenced_object_id =(SELECT object_id FROM  sys.tables WHERE name=@tblname)

--SELECT * FROM [getForignkeyTblName1]('MainTable')

What is Normalization?

Normalization is the process of designing a data model to efficiently store data in a database
  • Database normalization is a data design and organization process applied to data structures based on rules that help building relational databases.
  • In relational database design, the process of organizing data to minimize redundancy is called normalization.
  • Normalization usually involves dividing a database into two or more tables and defining relationships between the tables.
  • The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.

What are the Different Normalization Forms?

1NF - Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.

2NF -If an attribute depends on only part of a multi-valued key, then remove it to a separate table.

3NF -If attributes do not contribute to a description of the key, then remove them to a separate table. All attributes must be directly dependent on the primary key.

Rules for 3NF
  • To separate table for each set of related attributes, and give a primary key for each table.
  • If an attribute depends on only part of a multi-valued key, remove it to a separate table
  • If attributes do not contribute to a description of the key, remove them to a separate table.

Define Web Confiq

Web Config

     Web.config is the main settings and configuration file for an ASP.NET web application.
     The file is an XML document that defines configuration information regarding the web application.
     This file stores the information about how the web application will act.
     The web.config file contains information that control module loading, security configuration, session state configuration, application language compilation settings and connection String.

Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified

There are few things have to notice for above error, and do and check one by one.

1. Check that you are using correct version of ASP.Net in IIS( Check applicationpool ),if not select exact one. 
2. If your ASP.NET  Version is 3.5, Ajax dll inbuilted in Framework 3.5. So change your extension version to 3.5 in web confiq.
3. If your version is 2.0 you have to install ASPNET.2.0.AJAX.Extensions on your server.

Here i have given the link to download ASPNET.2.0.AJAX.Extensions.

4. Redirect old version to new version like below.
 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
   <bindingRedirect oldVersion="" newVersion="" />
   <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
   <bindingRedirect oldVersion="" newVersion="" />

5. Change public key version to 31BF3856AD364E35(its work, how ? me too)

I hope this will help you.

Could not load file or assembly 'MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Foxs, I have faced a trouble while migrate the site from one server to another. I have faced this problem. This problem is not migrate problem.

I received an error "Could not load file or assembly 'MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

This error belongs to higher version of  MySql.Data.dll. I dont have same version dll, So that am used higher version and use binding redirect option in web confiq file to resolve this problem.

Just i redirect old version to new version as like below.(under configuration)

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d"/>
        <bindingRedirect oldVersion="" newVersion=""/>

This resolved my problem.

Change TFS to Visual Source Safe in Source Control VS 2010

We have been given steps for change the option from Team Foundation Server to Visual Source Safe. please follow the same.

1.Tools --> select Options.
2.Option dialog box will appear once you select Options
3.Choose Source Control in the dialog box
4.Now you can select the option either Visual Source Safe or Team Foundation Server according to our necessary in Current Source control Plug-in

Now you can change Team Foundation server to Visual Source Safe.

I hope it will help you.

Google Algorithm Change – SERP Ranking Algorithm 2012 – Google Penguin Update

Google repeatedly turned down with many algorithm update and change right from past years. Google revealed algorithm in the versions Google panda 1.1, Google panda 2.2, Google panda 3.3 and Google penguin update as now recently. Moreover google penguin has been updated in a span of 10 days from its launched date [April 17 & April 27]. Not like previous panda update the new google penguin update has many features and barriers too for SEO. It drops many protocols for a websites’ SERP and the keyword ranking position.
1. Penguin update mainly focuses on backlinks of a website or webpage.
2.A website having links from unwanted category or unrelated websites, the SERP ranking of the website/webpage is automatically pushed down.
3. Also links from link farms and bulk directory submission is strictly restricted.
4. If more than 50 percent of the backlinks are from irrelevant websites, google marks it as webspam
5. When a website/web page gets more backlinks from unwanted categories remove those irrelevant links and increase links from
6. Google mentions the opposite of “white Hat SEO” as “black hat webspam”. Which means to get high relevant traffic spam items like unwanted links, irrelevant sites and links farms must be avoided.
7. While in a few days Google is ready to launch another algorithm to target and avoid webspam.
8.  Keyword stuffing and footer link keywords are another prey for google Penguin update.
9. Recent google algorithm change also tells about content duplication and content copywriting. When a website or webpage is having a duplicated content with the keywords stuffed or used, automatically the SERP and ranking positions of the keywords drowns away drastically.
10. The site owner may be in confused state for what reason changes have been done even though there is no unwanted backlinks, but still a drop in keyword positions and SERP.
The ultimate moral tip of google algorithm change and google penguin update 2012 is don’t make your content a duplicated one and with unwanted backlinks.

Google Panda Algorithm – Versions/Timeline of Google Updates

Google Panda is change to the Google’s search results ranking algorithm ,It was first released in Feb 2011. The change aimed to lower the rank of “low-quality sites”, and return higher-quality sites near the top of the search results.  CNET reported a surge in the rankings of news websites and social networking sites, and a drop in rankings for sites containing large amounts of advertising. This change reportedly affected the rankings of almost 12 percent of all search results. Soon after the Panda rollout, many websites, including Google’s webmaster forum, became filled with complaints of scrapers or copyright infringers getting better rankings than sites with original content. At one point, Google publicly asked for data points to help detect scrapers better. Google’s Panda has received several updates since the original rollout in February 2011, and the effect went global in April 2011. To help affected publishers, Google published an advisory on its blog[citation needed], thus giving some direction for self-evaluation of a website’s quality.
Google Panda was built through an algorithm update that used artificial intelligence in a more sophisticated and scalable way than previously possible. Human quality testers rated thousands of websites based on measures of quality, including design, trustworthiness, speed and whether or not they would return to the website. Google’s new Panda machine-learning algorithm, made possible by and named after engineer Navneet Panda, was then used to look for similarities between websites people found to be high quality and low quality.
Many new ranking factors have been introduced to the Google algorithm as a result, while older ranking factors like PageRank have been downgraded in importance. Google Panda is updated from time to time and the algorithm is run by Google on a regular basis.On April 24, 2012 the ‘Penguin’ update was released, which affected a further 3.1% of all English language search queries, highlighting the ongoing volatility of search rankings.


Get current Year in SQL SERVER


Above query return current year... Look below and execute these and you come to know. I will explain these later due to little busy.

SELECT datename(month,getdate())
SELECT datename(YEAR,getdate())
SELECT datename(DAY,getdate())
SELECT datename(WEEKDAY,getdate())
SELECT datename(DAYOFYEAR ,getdate())
SELECT datename(ISO_WEEK ,getdate())
SELECT datename(ISOWK ,getdate())



SELECT DATENAME(month,getdate()) AS [MONTH]




SELECT DATENAME(month,getdate()) AS [MONTH]