Pages

Wednesday, October 24, 2007

Sample Code to Kill/Destroy ASP sessions

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends

Try
'FormsAuthentication.SignOut()
Dim userObj As cUser = Session.Item("user")
If Not userObj Is Nothing Then
If Not Session("LogOut") = "True" Then
userObj.SaveUsageTrackingOnly(userObj.memberInfo.mUserName, "Session timeout", "Session timeout", "", , , Session("ClientAddress"))
End If
End If
userObj = Nothing

Session("Logout") = Nothing
'Reset system search session variable
Session("SystemSearchResult") = Nothing

Catch excobj As Exception
Dim j As Integer = 0

End Try
End Sub

Saturday, October 20, 2007

Windows Server 2003 Remotely Restart Tricks:

go to CMD -> Shutdown
Switches:
-a - Abort Shutdown
-s - SHUTDOWN
-f - Force
-r - Restart

Example: Shutdown -a -m \\Machine_Name --- it will Abort Shutdown
C:\>shutdown /r /m \\Machine_Name ---- It will Restart machine
shutdown -s -m \\Machine_Name - Shuts down a remote machine called 'victim'

Note: The sequence of switches is important shutdown -m -s \\ machine does not work

For more details click Here

Saturday, October 13, 2007

How to Disable SMTP Service Socket Pooling

Use the Mdutil.exe utility that is located on the Windows 2000 CD-ROM distribution media to disable SMTP Service socket pooling:
1. Copy the Mdutil.ex_ file from the I386 folder on the Windows 2000 CD-ROM to the InetPub\Adminscripts folder on your local hard disk.
2. Open a command prompt, change the location to the folder in which you copied the Mdutil.ex_ file, and then type the following command:

expand mdutil.ex_ mdutil.exe

3. Type the following command at the command prompt, and then press ENTER:

mdutil.exe enum -path:smtpsvc

4. Type the following command at the command prompt, where number is the SMTP Service number for which you want to disable socket pooling, and then press ENTER:
mdutil set -path smtpsvc/number -value 1 -dtype 1 -prop 1029 -attrib 1
NOTES:
• Run this command for each virtual server with a different value for number if you have multiple SMTP virtual servers.
• When you type the command, do not include a space between "smtpsvc/" and "number".
5. In the IIS snap-in, change the listening address for SMTP Service to an internal interface on the server.
After you disable socket pooling and change the SMTP Service listening address, you can use Server Publishing rules to publish an internal SMTP server.

Install the FrontPage Server Extensions for Windows

FrontPage Server Extensions are installed and configured by default in windows 2000. However, if the user has removed FrontPage Server Extensions or chose not to install them when Windows was installed, follow these steps to install and configure them:

Frontpage Installation steps are same for windows 2000 and 2003 server

1. In Control Panel -> double-click Add/Remove Programs.
2. In Add/Remove Programs -> click Add/Remove -> Windows Components.
3. Here click Internet Information Services (IIS)-> click Details
4. Select FrontPage 2000 Server Extensions -> click OK.
5. In the Windows Components Wizard, click Next.
6. Installation will run, you may need Windows 2000 Installation CD. Click Finish at last.
Note: Your system administrator account will be your Frontpage administrator.

Can I run my site created on Visual Studio .Net 2002 and .Net Framework 1.0. Planning to upgrade to Windows Server 2003 as Web Server?

Can I run my site created on Visual Studio .Net 2002 and .Net Framework 1.0. Planning to upgrade to Windows Server 2003 as Web Server?

Windows Server 2003 comes with .Net Framework 1.1, build 4322 pre-installed. This is the same version that comes with Visual Studio .Net 2003. It is possible that some of your code will fail on .Net Framework 1.1, as it is more secure, and you might have to change things to get your code to work. It is also possible to run .Net Framework 1.0 side-by-side with 1.1, until you have fixed your code to be 1.1 compatible.

I am getting error in using in asp file. I get error or similar:

IIS 6 is locked down by default. Parent Paths is a way for a hacker to navigate to a folder on the web server that has execute permissions, and in that way execute scripts that you normally shouldn't and wouldn't execute. If you enable this, make sure that you do not give execute permissions to a parent folder. To enable Parent Paths, follow these steps:

* Click Start->Programs->Administrative Tools->Internet Information Services
* Expand Web Sites and right click the web site you want to enable this for (i.e Default Web Site), click Properties
* Click the Home directory tab and click the Configuration button
* Click on the Options tab
* Check the box Enable Parent Paths

HTTP Error 404 - File or directory not found

Created a new *.ASP file but it is giving "HTTP Error 404 - File or directory not found". What is need to do?

By Default IIS 6 is lockdown, so you can not run asp, php scripts pages without enabling them in web service extension. Steps to enable ASP
* Click Start->Programs->Administrative Tools->Internet Information Services Manager
* Expand and click Web Service Extensions
* In the right pane, right click Active Server Pages and select Allow

ASP.NET Installation

ASP.NET Installation Steps for IIS:
If you install ASP.NET you will get it in the Web Service Extensions. To install it, follow these steps:

* Go to Control Panel, and double click Add or Remove Programs
* Click Add/Remove Windows Components
* Highlight Application Server and click Details
* Select to install ASP.NET and click OK
* Click Next, then click Finish
* Go to IIS, Click on Web Service Extension. Allow ASP.NET here.

Why is the date and time stamp on entries in the Internet Information Services (IIS) log file wrong with several hours?

If you have selected log file format as W3C Extended Log File Format, the date and time stamp will be in GMT. Solutions for this, either change the logging format or use the "convlog" utility to add the GMT offset in the log files.
For more details click here

I am getting "snap-in failed to initialize" when starting IIS Manager, how can I start IIS Manager?

The complete error message is:

Snap-in failed to initialize.
Name:
CLSID:{A841B6C2-7577-11D0-BB1F-00A0C922E79C}


To solve this problem, re-register the inetmgr.dll file.

* Click Start->Run, type cmd and press ENTER
* Type regsvr32 %systemroot%\system32\inetsrv\inetmgr.dll and press ENTER

Thursday, October 11, 2007

Opening the Port on Windows server 2003

Steps are: -
1. Go to Start à Control Panel à Administrative Tools à Services
Select the “Windows Firewall/Internet Connection Sharing (ICS)” service and right click then start the service.
2. Please run the following command from MS DOS prompt

> netsh firewall add portopening TCP 7799 "Application_Name"

"Application_Name" - your application for which you are opening port. Need to use without Quotes.

3. After the command executed successful, stop the ‘Windows Firewall/Internet Connection Sharing (ICS)’ service by right clicking the service and click on Stop menu (refer below screenshot).