function disableselect(e)
function reEnable()
//if IE4+
//if NS6
body
{
-moz-user-select: none;
}
ASP.Net, VB.Net, C#, Microsoft Visual Studio .Net, Quick Tutorials, .Net Tips and Tricks, asp.Net Tips and Tricks, Ajay Sharma's Blog, Java Script, javascript, HTML, .Net Sample Codes
function disableselect(e)
function reEnable()
//if IE4+
//if NS6
body
{
-moz-user-select: none;
}

The Regular Expression below validates the username format.
^[a-zA-Z0-9_]{5,20}$
So while creating a new user for a website you can validate the username string with the following business logic:
1) User name must be between 5 to 20 characters.
2) User name can have lowercase and uppercase characters.
3) User name can be alpha-numeric.
4) No special character allowed.
Implementation:
Asp.net HTML code:<asp:TextBox ID=”txtRegex” runat=”server”></asp:TextBox>
<asp:Button ID=”btnValidate” runat=”server” Text=”Validate value” OnClick=”btnValidate_Click” />
<asp:Label ID=”lblResultRegex” runat=”server” Text=”"></asp:Label></div>
using System.Text.RegularExpressions;
protected void btnValidate_Click(object sender, EventArgs e)In this post i am going to explain that how to access the System Registry and how to read and write data to registry.
Step 1: First you need to import the below namespaces:
using Microsoft.Win32;
Step 2: Now create an object of Registry class:
RegistryKey regkey;
Step 3: Now access the registry and get the value of a key
regkey = Registry.CurrentUser.CreateSubKey(@”Software\Microsoft\FTP”);
if (regkey.GetValue(”Use PASV”) == null)
{
txtValue.Text = “No Value Specified”;
}
else
{
txtValue.Text = regkey.GetValue(”Use PASV”).ToString();
}
The above code gets the value of the “Use PASV” key from the
Registry\CurrentUser\Software\Microsoft\FTP path.
Step 4: Set the key value
regkey.SetValue(”Use PASV”, txtValue.Text);
Many times we need to get the current user’s / visitor’s IP address.
Sometimes this is essential for security reasons.
We must leg the user’s IP address in the following situations:
1) where you accept data from user, like guestbook newsletter, search page etc. This gives a plus point to the security of website, as you can get the user’s identity by his IP if he do something wrong with your website.
2) User login pages. Alwayskeep record the logins of website users. Record the datetime and IP of user.
If you want to blok some particular users to use your website then on page load just ckeck the current Ip against database of ip’s you have created for blacklisting.
Now coming to the point,
How to get user’s IP address using asp.net
HttpContext.Current.Request.UserHostAddress;
or
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
The above code may return the IP with proxy.
Use the below code to get the IP address of the machine and not the proxy use the following codeA good example is of preloading in flash files, when you see a loader before displaying the content, and after loading site shows a smooth experience of flow of data.
This is mostly used when there is an mouser over images to be loaded. If user mouse overs an image and then you loads the new mouse-over image it may take a few seconds to load, which leads to a small blank image over the image area. By pre-loading the image you can show mouseover image instantly without any delay.In this post I am explaining how to do preaload imags in HTML using JavaScript, without using flash.
We have to use the Head tag of html as this is the one which loads on first page executiution.<head>
<script type=”text/JavaScript”>
pic2= new Image(190,53);
pic2.src=”images/storeSmall.gif”;
}
</head>
The above code lods two images naming productSmall.gif and storeSmall.gif respictively from images directory. It creates a new object of image and assigns it a dimention and a file to load.The document.imags condition has been used to determine that the browser supports the images or not.
Step 2: Drag and RequiredFieldValidator. Set it’s ControlToValidate property to the DropDownLis’s object.
Step 3: Fill some items in the DropDownList. Add a first item as “Select”. This will indicate the user that he should select an option.Step 4: Now set the RequiredFieldValidator’s “InitialValue” property to “Select”.
Now all of your code should look like this :<asp:DropDownList ID=”cmbCountry” runat=”server”>
<asp:ListItem>Select</asp:ListItem>
<asp:ListItem>India</asp:ListItem>
<asp:ListItem>USA</asp:ListItem>
<asp:ListItem>Canada</asp:ListItem>
</asp:DropDownList>
Now you are all set to go and test it.
Download Source Code here

Download Source Code here
Some website has right-click disabled so that user cant copy paste using mouse, or cant save images contained into webpage.
Copy paste this code
<body oncontextmenu=”return false;”>
Html page content here
</body>
**End of article**