Showing posts with label iis. Show all posts
Showing posts with label iis. Show all posts

Thursday, November 22, 2012

Page Cannot Be Found - 404 2 1260

When you got this error 'Page cannot be found' on IIS 6
Resolution is to enable ISAPI and CGI on Web Service Extension folder in IIS.
Reference: here

How do you know that error number 404 2 1260?
It's from the Log files, usually located at C:\Windows\System32\LogFiles\
can be found from the following step:

Go to your website properties -> On 'Web Sites' tab, click the 'Properties ...'
There's Log File name field above the buttons.
The for Default web site will be W3SCV1
From the log files u can see the logs of your IIS website.


Wednesday, November 21, 2012

.NET Get user name

Here are the different ways to obtain user name in .NET:

-- To obtain from windows logon
Environment.UserName


-- To obtain from Siteminder
Request.ServerVariables["HTTP_SMUSER"]

-- To obtain from authentication
Request.ServerVariables["AUTH_USER"]

-- To obtain from application
HttpContext.Current.User.Identity.Name
Page.User.Identity.Value

If you have other ways, pls add in here.


IIS -> Database

In order to connect into the database from IIS

If you want to use a special account, u can specify in the AppsPool
Here's how to set in IIS6:
- Open AppsPool properties
- Go to Identity
- Select the configurable and put in the user name and password to connect to the database there.

However if you would like to use user's logged in account u need to add the following into your web.config
<identity impersonate="true"/>

Reference: here

Authentication Methods
In order to use Windows authentication, you may set the following in IIS:
  • If SQL Server is on the same computer as IIS, select the Integrated Windows authentication check box.
  • If SQL Server is a remote server, select the Basic Authentication check box and clear the Integrated Windows authentication check box.
In order to remove the prompt for username and password in IIS6 for Windows Authentication, you need to perform the following:
1) Open IIS
2) Open the website properties
3) Click 'Properties...' button (under Logging) on the Web Sites tab.
4)Take note of the website ID, the number after W3SVC
Default WebSite ID will be 1.
5) Open command prompt
6) Go to directory C:\Inetpub\AdminScripts
7) To check if the NT Authentication Provider is set, type  
cscript adsutil.vbs get w3svc/<WebSiteID>/root/NTAuthenticationProviders  
Note: Please replace the with the website ID from step 4.
8) If it’s not set or if the value is not NTLM, please set the NT Authentication Providers by typing the following cscript adsutil.vbs set w3svc/<WebSiteID>/root/NTAuthenticationProviders "NTLM"
Note: Please replace the with the website ID from step 4.
Once you have set, please perform step 7 to check if it is already “NTLM"
 After you set this, once you open your website (for Integrated Windows Authentication), it will not prompt the username and password.