Posted by cavemansblog on September 11, 2009
The wait time for a screen saver specifies how much user idle time must elapse before the it is launched. This can be changed by accessing the property pages of the desktop, in the Screen Saver tab. How ever when a group policy is set to not editable on this setting, one cannot edit this setting using the property pages, even if the user has administrator right on that computer.
The work around for this is to directly edit the value of the “ScreenSaveTimeOut” key at the following location. The value is represented in seconds, the setting below has a time out of 30 mins.
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]
"ScreenSaveTimeOut"="1800"
Posted in Sudheer Reddy Battula | 1 Comment »
Posted by cavemansblog on August 11, 2009
Writing code in a web application with not access to HttpContext and still need to map to a folder in the website? No problem.. you can use the System.Web.Hosting.HostingEnvironment.MapPath function.
//This is how you would map if you had access to the HttpContext object
System.Web.HttpContext.Current.Server.MapPath("~/App_Data/data.xml");
//and here is how you would map if you do not have access to the HttpContext object
System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/data.xml");
Posted in ASP.Net, Sudheer Reddy Battula | Tagged: MapPath | Leave a Comment »
Posted by cavemansblog on August 3, 2009
Following are some keyboard shortcuts that use very often.
- Ctrl + Enter – Auto complete a URL, prepends and appends a website name with “http://” and “.com”.
- Shift + Enter – Auto completes a URL, prepends and appends a website name with “http://” and “.net”.
- Ctrl + shift + Enter – Auto completes a URL, prepends and appends a website name with “http://” and “.org”.
- Ctrl + Esc – Opens the Start menu.
- Ctrl + Tab – Switch between open tabs in a MDI.
- Ctrl + Shift + Tab – Switch between open tabs in a MDI in reverse order.
- Ctrl + Shift + Esc – Opens windows task manager.
- Ctrl + A – Make a selection.
- Ctrl + T – Open a new tab in IE, Firefox, Chrome.
- Ctrl + W – Close a tab in IE, Firefox, Chrome.
- Ctrl + X – Cut
- Ctrl + C – Copy
- Ctrl + V – Paste
- Ctrl + Z – undo
- Ctrl + R – Redp
- Ctrl + B – Bold
- Ctrl + S – Save the file
- Ctrl + U – Underline a selection
- Ctrl + F – Find
- Ctrl + H – Search and Replace
- Ctrl + G – Go to line #
- Ctrl + O – Opens file dialog box
- Ctrl + P – Opens print manager
- Ctrl + D – Bookmark a web page in a browser
- Alt + Tab – Switch between open programs
- Alt + Shift + Tab – Switch between open programs in reverse order.
- Alt + Enter – Display properties (file, folder, etc).
- Alt + F4 – Close a window.
- Alt + Space – Display system menu of active window.
- Alt + Home – Launch home page in a browser application.
- F1 – open help file of the current application.
- F2 – rename a file.
- F5 – Refreshes the current window
- Shift + F10 – Display context menu
- Windows logo + E – open explorer
- Windows logo + M – Minimize all windows
- Ctrl + Alt + End – Security dialog in remote desktop
- Ctrl + Alt + Break – Toggle full screen in remote desktop
- Alt + Home – Display start menu
Posted in Sudheer Reddy Battula | Tagged: windows Keyboard shortcuts | Leave a Comment »
Posted by cavemansblog on July 28, 2009
The web.config is a file that is not accessible to the user of a web application via a browser. The dotnet framework shields this file from all kinds of external intrusion. However someone having access to the physical file can steal sensitive information.
This vulnerability can be overcome by using aspnet_regiis, an in-build ASP.Net tool. Following these simple steps, sections of the web.config can be encrypted (and/or decrypted) to secure the configuration settings:
Step 1: Encrypt connection Strings in the web.config. This command uses RSAProtectedConfigurationProvider (uses TripleDES and RSA encryption) for encrypting sections of the web.config file. This command has to be executed in a Visual Studio 2005/2008 command prompt window at the location where the web.config resides:
aspnet_regiis -pef connectionStrings .
Step 2: Adding users to the ACL of the key containers using the –pa parameter. Give access to the ASP.NET user:
aspnet_regiis -pa “NetFrameworkConfigurationKey” “ASPNET”
Step 3: Decrypt Connection Strings to clear text
aspnet_regiis -pdf connectionStrings .
The best part is that, the web application code does not have to change one bit after the encryption of web.config file. Following is a before and after view of the Connection Strings section of a web.config file:
Before:
<connectionStrings>
<add name="MembershipConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\LOCALDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
After:
<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>Rsa Key</KeyName>
</KeyInfo>
<CipherData>
<CipherValue>Qnp5eTaECH2wMwlRJjne61lKvEcRfZ3NDeCUhtw+wRKPmmY3Z3iZPBowIZwclU6gjdmY48/dhAEdUCLmzM5iEfHmPoyli+LMW5Yz1pQZM8I7iTFLLgeKux1CgUwP+bUtCpvP66Vu5wL5/veYSiR7kGzu/FgH+8vM6M3SYusHVGQ=</CipherValue>
</CipherData>
</EncryptedKey>
</KeyInfo>
<CipherData>
<CipherValue>BPA8J8Vue27wc4COgJ2Pfk9XCe7umTNAKdTJ2WnsyIg/zpEpdL4H6zxE0b5DBFehWTARRAtxfJhNUz4mp+QZvBZ0Iod1utujiXP0+EiWZpY8v31s94lgFhE88cH/CoF/vZgHYyDfedBTtJtUyN1xpegxzHHy38IwDElXUhb3UHP3X3nRWPJ0AohYz8xZZRMzn8MEDJDWCoKErwtMpUbE08AEZHDQSU6ITSn5urNrgS+V2CYYwhY3t1VbA2b+mEQFxVin4bEvOl+O8HGl2kzPtq5rhN60FnbxjPyHwCeHvl8JOzjk/ND8go/w49N61eGrGOH2xFNFPw2mhGVkJD5Lm8nn7xeo30YSS+Ct9uGzLfs=</CipherValue>
</CipherData>
</EncryptedData>
</connectionStrings></pre>
Tip: Here is how to secure appsettings
Encrypt appSettings: aspnet_regiis -pef sppSettings .
Decrypt appSettings: aspnet_regiis -pdf sppSettings .
References:
1. How To: Encrypt Configuration Sections in ASP.NET 2.0 Using RSA
2. Encrypting configuration files using protected configuration
Posted in ASP.Net, Dotnet, Sudheer Reddy Battula | Tagged: aspnet_regiis, encrypt web.config | 1 Comment »