Tuesday, March 24, 2009

Asp.net Querystring Encrypt

ur query string in url address will be encrypted but u can access querystring using
Request.QueryString["<QueryStringName>"].
no need to add any xtra code, just follow below 2 steps

1. Download .cs file from http://blog.madskristensen.dk/post/HttpModule-for-query-string-encryption.aspx

2. modify web config file


<httpModules>
<add type="QueryStringModule" name="QueryStringModule" />
</httpModules>

Friday, March 20, 2009

Delete Key Fro registry

RegistryKey key = Registry.CurrentUser;
key.DeleteSubKey("Software\\Rosh");

//Removing From startup
Registry.LocalMachine.OpenSubKey ("SOFTWARE\ Microsoft\Windows\ CurrentVersion\ Run", True).DeleteValue(Application.ProductName)

How to run an application next to installation finish in Visual studio

In your setup & deployment project

Step 1: Create a vbs file with following command

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """" & Property("CustomActionData") & """",5,False
Set WshShell = Nothing

Step 2: Open file system (View-->Editor-->File System) window

Create a new folder (suppose, Launch) and add above vbs file into the folder.
Also add the .exe file, which should run after setup application finish.

Step 3: Open Custom Action (ViewEditorCustom Actions) window
There u can see 4 tree nodes
1. Install
2. Commit
3. Rollback
4. Uninstall
Step 4: Right click on Commit Node and select Add Custom Action

Step 5: select our vbs file from file system.
Now in Commit folder contains a vbs file

Step 6: Select the vbs file and change CustomActionData property as

[TARGETDIR]YourApp.exe

Where YourApp.exe is the name of the file you want to execute after installation
[Note : yourApp.exe and .vbs file should contain in the same folder]

For Execute an application after uninstall process

Do the same step in Uninstall folder

Tuesday, March 10, 2009

Remove quotes from string C#

System.Text.RegularExpressions.Regex.Replace(your Variable, expression, replace Character/string);

below ex remove quotes from input string

string str=@"ha\"llo\"
System.Text.RegularExpressions.Regex.Replace(str, @"""|\\", "");