WindowsIdentity.GetCurrent().Name in ASP.NET

You can use following code, if you want to know the user under which your ASP.NET application is running. 

Add following namespace on top of your web page,
using System.Security.Principal; 

Add following code to Page_Load event,
WindowsIdentity id = WindowsIdentity.GetCurrent();                
Response.Write("Account Name: " + id.Name + "<br>");

Display Current Time on the web page

Below example helps you to display current time on the web page. Textbox value will be updated with the current time every second.

Add following code to the page,
<script type="text/javascript">
    function DisplayTime() 
    {
        var currentDate = new Date();
        document.getElementById("<%= TextTime.ClientID %>").value = currentDate.toLocaleTimeString();
        window.setTimeout("DisplayTime()", 1000);
    }   
</script>

<script type="text/javascript">
    window.setTimeout("DisplayTime()", 1000);
</script>

<asp:TextBox ID="TextTime" runat="server"></asp:TextBox>

Javascript Alert message from code behind in ASP.NET

We all know that we can display javascript alert message from code behind in ASP.NET using Page.ClientScript.RegisterStartupScript.
Page.ClientScript.RegisterStartupScript(this.GetType(),"myscript","alert('hello world!');");
However, above method can break under ASP.NET AJAX environment. For AJAX we need to use ScriptManager.RegisterStartupScript. Below code displays javascript alert message both in AJAX environment and on regular page as well.
ScriptManager.RegisterStartupScript(this,this.GetType(),"myscript","alert('hello world!');",true);
For more information on ClientScriptManager.RegisterStartupScript Method you can visit,

Space Example in VB.NET

If you want to return a string that contains the specified numbers of spaces or if you want to append a number with specified number of spaces then below example will help you solve the problem.
You can use below code too if you want to append or add blank spaces to the right of the string or number.

Dim part2 as Integer
Dim part3 As String

part2 = 12345
part3 = part2.ToString() + Space(5)
MsgBox(part3.Length())


Above example will add 5 blank spaces to the number 12345. So the Length of the number is 10 and the messagebox will return 10.

Open a new Window in JavaScript

How  to Open a new Window in Javascript/using Javascript is easy. Copy below code in your page.

If you want to open a new window on button clik then use below code,
<input type="button" value="Open New Window" onClick="OpenNewWindow('http://www.google.com')" />

If you want to open a new window using hyperlink then use below code,
<a href="javascript:OpenNewWindow('http://www.google.com/')">Open Google</a>

Copy below javascript code between your <head> and </head> tags on the page.
<script type="text/javascript">
        function OpenNewWindow(url)
        {
            newwindow = window.open(url, 'mywindow', 'width=600,height=700'); 
            newwindow.focus();
        }
</script>