Thursday, April 17, 2008

Err Msg: “The system cannot log you on to this domain because the system’s machine account in its primary domain is missing or the password..."

Error Message: “The system cannot log you on to this domain because the system’s machine account in its primary domain is missing or the password on that account is incorrect”

Today, I need to login my ex-colleague’s PC to setup something at that PC. The PC had not been used anyone for a few months. When I trying to log on to the domain, the error message mentioned in above is displayed. However, I can log into locally.

I tried to do some configuration setting of the PC but the issue still not been solved. After that, I tried to search with the error message in Google and find the solution to resolve the issue.

Solution:
If you face this problem, determine whether the PC can be logged into locally. If can, try to perform the following steps to resolve the issue:

Remove the Server from the Domain:

  1. Click [Start], point to [Settings], click [Control Panel], and double-click [System]
  2. On the [Network Identification] tab, click [Properties]
  3. Under [Member Of], click [Workgroup], type the name of a workgroup to join, then click [OK]
  4. Click [OK] again
  5. Restart the PC
Add the Server back to the Domain:
  1. Click [Start], point to [Settings], click [Control Panel] then double click [System]
  2. On the [Network Identification] tab, click [Properties]
  3. Under [Member Of], click [Domain], type the name of a workgroup to join, then click [OK]
    When prompted, provide a user name and password, and join the PC to the domain.
  4. Restart the PC
Then try to log on the domain, the problem solved.

Sunday, April 13, 2008

Different between Authorization and Authentication (.NET)

Authentication is the mechanism where a system uses to identify their user. In ASP .NET, the authentication may be set in web.config file to verify the credentials of the user and decides whether the user is authenticated or not.

Authorization is the mechanism where a system uses to determine what level of access for a particular user.

So, when a user logs on to a system, the user will be authenticated first before be authorized.

Ways to authenticate user in ASP .NET:

  1. Forms Authentication
    This authentication depends on code written in the system. Credentials are entered on web forms then used to match with the user information in the database table.
  2. Windows Authentication
    This authentication is the default authentication provider for ASP .NET application. The user logs in to an application using this authentication, the credentials are matched with the Windows domain through IIS.
    There are 4 types of Window Authentication methods:
    • Anonymous Authentication – IIS allows any user
    • Basic Authentication – windows username and password (credentials) has to be sent across the network in plain text format (not very secure).
    • Digest Authentication – Same as Basic Authentication but the credentials are encrypted.
    • Integrated Windows Authentication – Depend on Kerberos technology, with strong credential encryption.
  3. Passport Authentication
    This authentication already obsolete in .NET 2.0
  4. “None” mean no authentication

Types Authorization in .NET
  1. File Authorization
    Relying on the NTFS system for granting permission
  2. Url Authorization
    Specify authorization rules in web.config for different web URLs.

Thursday, March 20, 2008

Calling Javascript Function from Code Behind (.vb)

This is the function at html page:

<script language="javascript">
   function test()
   {
      //Add the function code here
   }
</script>


To call this javascript function from code behind (.vb), Use Page.RegisterStartupScript function like the code below:

Dim strScript As String = "<script language='javascript' id='myClientScript'>test();</script>"
Page.RegisterStartupScript(“callTest”,strScript)

Tuesday, March 18, 2008

SQL Query Script Used to List out All User Table Name of a Database

To List out all user table name of a database, just using the query statement as below:

SELECT Table_Name
FROM INFORMATION_SCHEMA.Tables
WHERE Table_Type = 'BASE TABLE'

Tuesday, March 11, 2008

Ways to Convert Date to Different Formats in SQL Server 2000

You may want to convert the date into different format that you want. At here, I got example how to convert date to 15 different formats using SQL Query.

--'YYYYMMDD'
SELECT CONVERT(CHAR(8), GETDATE(), 112)
--'YYYY-MM-DD'
SELECT CONVERT(CHAR(10), GETDATE(), 23)
--'YYYY-MMM-DD'
SELECT STUFF(CONVERT(CHAR(10), GETDATE(), 23), 6, 2, LEFT(DATENAME(m, GETDATE()), 3))
--'YYMMDD'
SELECT CONVERT(VARCHAR(8), GETDATE(), 12)
--'YY-MM-DD'
SELECT STUFF(STUFF(CONVERT(VARCHAR(8), GETDATE(), 12), 5, 0, '-'), 3, 0, '-')
--'YY-MMM-DD'
SELECT STUFF(STUFF(STUFF(CONVERT(VARCHAR(8), GETDATE(), 12), 3, 2, LEFT(DATENAME(m, GETDATE()), 3)), 6, 0, '-'), 3, 0, '-')
--'MM-DD-YY'
SELECT CONVERT(CHAR(8), GETDATE(), 10)
--'MMDDYY'
SELECT REPLACE(CONVERT(CHAR(8), GETDATE(), 10), '-', SPACE(0))
--'MM/DD/YY'
SELECT CONVERT(CHAR(8), GETDATE(), 1)
--'MM/DD/YYYY'
SELECT CONVERT(CHAR(10), GETDATE(), 101)
--'DD-MM-YY'
SELECT REPLACE(CONVERT(CHAR(8), GETDATE(), 3), '/', '-')
--'DD-MMM-YY'
SELECT STUFF(REPLACE(CONVERT(CHAR(8), GETDATE(), 3), '/', '-'), 4, 2, LEFT(DATENAME(m, GETDATE()), 3))
--'DDMMYY'
SELECT REPLACE(CONVERT(CHAR(8), GETDATE(), 3), '/', SPACE(0))
--'DD/MM/YY'
SELECT CONVERT(CHAR(8), GETDATE(), 3)
--'DD/MM/YYYY'
SELECT CONVERT(CHAR(10), GETDATE(), 103)


Hope that is one the format you want. If not, please write a comment with the format date you want. I will try my best to help you. Thanks.