Security

SQL Server 2008 : Enable xp_cmdshell

2

The xp_cmdshell option is a server configuration option that enables system administrators to control whether the xp_cmdshell extended stored procedure can be executed on a system.

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
--To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO

References
http://technet.microsoft.com/en-us/library/ms190693.aspx

SQL Server 2008 : OLE Automation

9

Ole Automation in SQL Server 2008 by default is turned off for security reasons. When OLE Automation Procedures are enabled, a call tosp_OACreate will start the OLE shared execution environment.

Executing the following script will enable Ole Automation

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO

References
http://msdn.microsoft.com/en-us/library/ms191188.aspx

How to get Windows Login credentials using C#.Net , ASP.Net

5

one of the most famous topics is how we can know the current user credential like

user name, Groups, Authentication Type   (I hope to find a way to know password :-) )

check this code

Console.WriteLine("AuthenticationType =" + WindowsIdentity.GetCurrent().AuthenticationType);
Console.WriteLine("Name ="+WindowsIdentity.GetCurrent().Name);
Console.WriteLine("Groups :");
foreach (IdentityReference ir in WindowsIdentity.GetCurrent().Groups)
{
          Console.WriteLine(ir.Translate(typeof(NTAccount)).ToString());
}

and this a another way to get Windows Identity

WindowsPrincipal p = Thread.CurrentPrincipal as WindowsPrincipal;
(p.Identity as WindowsIdentity)

and for ASP.Net

HttpContext.Current.User.Identity

for more information
Windows Principal , Windows Identity
Go to Top