Thursday, November 12, 2009
Read files through Javascript
1) An ASP.Net application is configured in a server.
2) I need to open a file from client side in a text area(the file can be any type)
3) I can modify it
4) I need to save the modifications in the same path of client
Here we can’t open the file in Fileupload control, since it uploads the file to the server location. The modified file can’t be save in the clients location.
So, I went for Javascript. I just copy a code for illustration
<form id="form1" runat="server">
<div>
<input type=text id="txtFile" /><input type="button" id="btnSub" value="Open" onclick="ReadFiles();" />
</p>
<textarea id="txtFileData" name="S1"></textarea></div>
</form>
<script>
function ReadFiles()
{
var txt=document.getElementById('txtFile').value;
var fso, f1, ts, s;
var ForReading = 1;
fso = new ActiveXObject("Scripting.FileSystemObject");
ts = fso.OpenTextFile(txt, ForReading);
s = ts.ReadLine();
while(!ts.AtEndOfStream)
{
s=s + ts.ReadLine();
}
document.getElementById('txtFileData').value=s;
ts.Close();
}
</script>
But here the Browser settings should enable the activeX objects.
Thread abort exception
Cause of this issue is:
The Response.End method ends the page execution and shifts the execution to the Application_End Request event in the application's event pipeline. The line of code that follows Response.End is not executed.
Same issue occurs in Response.Redirect & Server.Transfer (Since Response.End is called internally for these methods).
Remedies provided by microsoft are as follows.
1) Use HttpContext.Current.ApplicationInstance.CompleteRequest method instead of Response.End to bypass the code execution to the Application_End Request event.
2) For Response.Redirect, use an overload, Response.Redirect(String url, bool endResponse) that passes false for the endResponse parameter to suppress the internal call to Response.End.
Example
Code:
Response.Redirect ("Default.aspx", false);
3) Use Server.Execute method instead of Server.Transfer
Lessons Learned
1)Always use the overloaded method of Response.Redirect and use false for end response
2)Use HttpContext.Current.ApplicationInstance.CompleteRequest instead of Respons.End
3)Use Server.Execute method instead of Server.Transfer
Tips to improve performance for an asp.net application
2) Turn off Tracing unless until required
3) Turn off Session State, if not required
4) Disable View State of a Page if possible
5) Set debug=false in web.config
6) Avoid Response.Redirect as many places
7) Use the String builder to concatenate string
8) Avoid throwing exceptions
9) Use Finally Method to kill resources
10) Use Client Side Scripts for validations
11) Avoid unnecessary round trips to the server
12) Use Gzip Compression
13) Use Page Output Caching and Proxy Servers
14) Use Per-Request Caching
15) Use Page.ISPostBack
16) Include Return Statements with in the Function/Method
17) Use Foreach loop instead of For loop for String Iteration
18) Include Return Statements with in the Function/Method
19) Avoid Unnecessary Indirection
20) Use "ArrayLists" in place of arrays
21) Always check Page.IsValid when using Validator Controls
22) Use custom Paging
23) Store your content by using caching
24) Use low cost authentication
25) Minimize the number of web server controls
26) Avoid using unmanaged code
27) Return Multiple Resultsets
28) Avoid making frequent calls across processes
29) Cleaning Up Style Sheets and Script Files
30) Design with ValueTypes
31) Minimize assemblies
32) Encode Using ASCII When You Don't Need UTF
33) Avoid Recursive Functions / Nested Loops
34) Minimize the Use of Format ()
35) Place StyleSheets into the Header
36) Put Scripts to the end of Document
37) Make JavaScript and CSS External
38) Use DataReader instead of Dataset
39) Make Enableviewstate property as false for the components(particularly for heavy items like datagrid, datalist etc) if it is not necessary.
40) Use xmlhttprequest object or scriptmanager to minimize post backs.
Cookies safety
A tag in the web.config file as follows will disable this.
<httpCookies domain="String" httpOnlyCookies="true" requireSSL="false" />
This will limit the attackers to gain access to this sensitive information through Cross Site Scripting (XSS) attacks
Monday, November 9, 2009
Best anti viruses as of 2010
Price: $19.99
Description:
The best part of using Security Shield 2010 is the fact that is powered by BitDefender. This antivirus company protects tens of millions of home and corporate users across the globe. The Shield Deluxe 2010 will protect your PC and personal data from theft, making it worth considering.
Advanced Features:
Total virus and spyware protection
Free technical support
Intelligent scanning
Real time threat detection
Hourly updates, Vista compatible
Decides best security actions to take
Stealth web browsing Excellent extended parental controlsUses and minimal system resources
Monitors the activity of programs and processes that have been launched in the computer’s memory.
Controls over changes in the file system. Proactive protection.
Removes spyware parasites to protect your privacy and prevent system crashes and slow-downs.
Protection from rootkits and worms.
Blocks access to inappropriate websites and e-mail.
Reduces the system load and postpones updates, allowing for secure gaming at top speed.
Scans all Web, e-mail and instant messaging traffic in real-time.
Advanced system maintenance tools.
2. Trend Micro Antivirus Internet Security 2010
Price: $39.95
Description:
Trend Micro AntiVirus plus AntiSpyware 2010 provides comprehensive and easy to use protection from viruses, intruders, and other Internet-based threats. Inexpensive product received excellent scores in our performance tests.
Advanced Features:
· Effective Antivirus Protection
· Customizable security for your home PCs
· Prevents virus-infected emails
· Home Protection for up to 3 PCs
· Spyware and Adware Protection
· Automatic Virus Pattern Updates
· Enhanced Software History Cleaner
· Effective Antivirus Protection
· Excellent value
· Free phone, email and chat support, with your annual subscription.
· Block websites with inappropriate content based on specific categories.
· Protect your privacy by getting rid of records listing Web sites and files recently opened.
· Stops viruses, worms, spyware and bots.
· Automatically download the latest signature updates. Quarantined file recovery.
· Real-time protection. You can run scheduled and manual scans.
· Keeps your system protected against all types of malicious threats.
· Remote File Lock safeguards your private files in case your laptop is lost or stolen.
3. Norton Antivirus 2010
Price: $39.99
Description:
Norton AntiVirus 2010 provides fast, responsive defense against all types of malicious software. The new Norton Protection System employs a multilayered set of security technologies that work in concert to detect, identify, and block attacks.
Advanced Features:
· Advanced antivirus with anti-spyware and Secures, stores and manages login and personal information
· Automatically saves important files locally or to secured online storage
· Maps your wireless home network
· Free chat and phone support.
· Monitor your home network and more safely connect to Wi-fi networks.
· AutoFix technology will diagnose and fix common problems for you.
· Automatically schedules scans and updates to occur while PC is idle.
· Blocks browser exploits and protects against infected Web sites.
· Prevents unauthorized users from changing your critical applications.
· Monitors all processes and registry changes.
· New Norton Internet Worm Protection blocks certain more sophisticated worms (such as Blaster and Sasser) before they enter your computer.
· Best proactive protection
· Rapid pulse updates every 5 to 15 minutes
· Rootkit detection, two way firewall
· Defends against Web-based attacks and Automatic Virus Pattern Updates
4. Panda Antivirus Pro 2010
Price: $49.95
Description:
Panda Antivirus features a new ultraFast scan engine, 30% faster than its predecessors, Panda's exclusive SmartClean technology. In a nutshell, a good antivirus solution for Windows, that keeps your computer protected from any Internet threats.
Advanced Features:
· Automatically eliminates viruses
· Anti-Malware Engine
· On-demand scanning
· Smart auto-configuration
· Automatic Virus Pattern Updates
· Intrusion prevention blocks known and unknown hacker attacks and vulnerability.
· Identity protection: Anti-Phishing Filter, Anti-Banking Trojans Engine.
· Incorporates an advanced heuristic scan that detects more identity theft.
· Identity protection: Anti-Phishing Filter, Anti-Banking Trojans Engine.
· Personal Firewall protects you against Internet-borne worms and hacker attacks.
· Removes all traces of clutter left by spyware on your PC.
5. ZoneAlarm Anti-virus 2010
Price: $19.95
Description:
New engine delivers the best virus protection with significantly enhanced detection and removal capabilities. A configuration wizard leads you through setup, making it easy for everyday users to secure their systems fast.
Advanced Features:
- Wireless PC Protection: it sets appropriate security.
- Pre-loaded security settings provide easy, instant virus protection.
- Minimum PC resources and bandwidth consumption.
- Proactive firewall protection with multiple layers of security.
- Compatible with Windows 7
- Advanced antivirus, spyware removal protection
- On demand scanner interface
- Simple to install and run
- Advanced virus removal technology
6. ESET NOD32 Antivirus T NOD32 Antivirs
Price: $39.99
Description:
ESET NOD32 Antivirus proactively detects and disables viruses, trojans, worms, adware, spyware, phishing, rootkits. It includes advanced archive scanning, access control for removable media.
Advanced Features:
- Blocks all attempts to collect and forward your confidential data.
- Best protection against zero-day threat and attacks.
- Small size of update files, fast scanning speed and accurate detection .
- Offers several layers of protection including real time email scanning.
- Uses a combination of filtration methods
- Identifies known and unknown threats
- System restore
7. Kaspersky Anti-Virus 2010
Price: $39.95
Description:
Kaspersky Anti-Virus protects your computer against known and unknown threats, and against unwanted data. Besides, it monitors system activities by user applications, preventing any dangerous actions by applications.
Advanced Features:
- E-Mail IMAP and NNTP protocol checking support
- Built-in system restore capabilities included
- You can e-mail or call a toll-free number for live technical support
- Users can change interface appearance
- New threat response time: less than 2 hours
- Heuristic analyzer
- Self-protection from malware
- Free Trial
- Scans files and Internet traffic
- Updates automatically
Sunday, November 8, 2009
Sanbox search is refined and instant
The redundant data is null in the new search algorithm. Which is on production now. I'm using the new one. Which is really helpful for me to search many things instantly.
http://www2.sandbox.google.com/
The graphical part is as same..
Friday, November 6, 2009
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Access is denied: 'MyWebApp'.
Source Error:
Line 198:
As you can see the debug information is quite unclear and it would leave no trace of idea as to where the problem is.
The actual problem is because of the Microsoft Indexing Services which scans the Temporary ASP.NET Files and while doing so, the system puts a lock on the same.
To resolve this, the following steps need to be carried out:-
Start - Settings - Control Panel - Administrative Tools - Computer mangement.
Expand the services and applications node and select the Indexing service node.
Expand the Indexing Service Node and then select and expand the System Node.
Right click on Directories and select new directory. browse the path to the temporary asp.net files c:\winnt\microsoft.net\framework\v1.1.4322\.
Select the temporary asp.net files. give ok and then select the "NO" in the Include in index radiobutton.
give ok and then stop and start the indexing service.
Google History by Timeline --- Awesome
Kindly check their Growth history by years
Click here
ASP.NET 3.5 JavaScript Intellisense hotfix

Microsoft has released a hot fix for JavaScript IntelliSense in Visual Studio.
The fix can be applied on VS.NET 2008 with SP1.
All we need to do is copy the JavaScript doc (in XML documentation format as used in standard C# documentation), with "-vsdoc.js" appended to the JScript file name, in the same source folder.
Also, we can use the intellisense in an external JavaScript file, by specifying the configuration line on top of our JavaScript file.
Code:
///
May be we can use the same to create our custom well documented JScript library..
Definitely a productivity improvement tool for ASP.NET developers..
References:
VS 2008 JavaScript Intellisense @ ScottGu's Blog
Visual Studio patched for better jQuery IntelliSense
IntelliSense flavor for Visual Studio 2008 JavaScript files @ Microsoft Help and Support
JQuery IntelliSense in Visual Studio 2008
The format for JavaScript doc comments
HttpCompression
(depending on the browser support).
In PHP / ColdFusion this is built in and can be done using popular plug-in like Combine and Minify.
In ASP.NET this can be achieved by either configuring the IIS, or modifying the Global.asax file. There is an online tool available to check the compressionClick here online tool
Rate of compression is more means faster response, less bandwidth, and a more satisfied end-user!! But take care while using this in AJAX application. Better don’t go for it.
void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
string acceptEncoding = app.Request.Headers["Accept-Encoding"];
Stream prevUncompressedStream = app.Response.Filter;
if (!(app.Context.CurrentHandler is Page app.Context.CurrentHandler.GetType().Name == "SyncSessionlessHandler")
app.Request["HTTP_X_MICROSOFTAJAX"] != null)
return;
if (acceptEncoding == null acceptEncoding.Length == 0)
return;
acceptEncoding = acceptEncoding.ToLower();
if (acceptEncoding.Contains("deflate") acceptEncoding == "*")
{
// defalte
app.Response.Filter = new DeflateStream(prevUncompressedStream,
CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "deflate");
} else if (acceptEncoding.Contains("gzip"))
{
// gzip
app.Response.Filter = new GZipStream(prevUncompressedStream,
CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "gzip");
}
}
We have two compression methods. They are Deflate and GZIP. They are using the name space System.IO.Compression