ASP.NET:How to write error messages into a text file using a simple httpModule

In one of my previous posts, I mentioned about how to troubleshoot some issues with the use of a module. In this post, I will show you how a similar module could be of use when you want to log all the errors in a text file for troubleshooting purposes. Please ensure that C:\Temp folder…


Run a batch file as a specific User (or Administrator) from ASP.NET…

…well first of all, I am NOT recommending it, but sometimes it could be necessary! Now, let’s proceed to the code… 1. Create a page called RunBatchFile.vb and paste the following… Imports System.Diagnostics Imports System.IO Partial Class RunBatchFile Inherits System.Web.UI.Page Dim _password As New System.Security.SecureString Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)…

3

Sample page in ASP.NET to show you different collections like Forms, Querystring, Cookies etc

Sometimes, while troubleshooting I am interested to find out all the details about certain collections in ASP.NET, like Forms, QueryStrings, Headers, ServerVariables, Cookies, Sessions and Params… I created a very simple aspx page which would show you all the details… Create any text file with .aspx extension in your IIS (I have named it Collection.aspx)…

5

Changing ASP.NET version in ASP.NET tab of IIS has no effect

I ran into another similar issue while playing around and thought I must share… By default, when you open IIS Manager, right click on any Virtual Directory and click on Properties it would show the following dialog box. Note that, I have activated the ASP.NET tab and the ASP.NET Version is showing as blank!!! I have Framework…


customErrors defaultRedirect is not redirecting in ASP.NET

In one of my projects I was trying to use customErrors in ASP.NET and it was not working as I would expect. In the web.config I had the following… <customErrors defaultRedirect=”~/Misc/ErrorPage.aspx” mode=”On”>   <error statusCode=”404″ redirect=”~/Misc/ErrorPage.aspx” /></customErrors> Here is how my virtual directory TestingRedirection looks like… I have an error page called ErrorPage.aspx in a subfolder called Misc….

2

Using Forms Based Authentication in ASP.NET for Static Content (Doc Files, PDF Files etc.)

Scenario:You want to implement Forms based authentication for ASP.NET web application, and you have certain document/PDF files which need to be protected. It should be such that even if you try to browse that .doc file directly, it should take you to the Login Prompt OR it should simply deny access to the file. In a…

8

Troubleshooting Session Related Issues in ASP.NET

In this article I have discussed some of the common reasons for session loss issues in ASP.NET. I have also discussed about how you should think of fixing these issues yourself in a logical way. http://aspalliance.com/1182_Troubleshooting_Session_Related_Issues_in_ASPNET Hope this helps! Rahul Share this post : email it! | bookmark it! | digg it! | reddit! |…

1

A sample aspx page to show the security details

This is a pretty small sample to help you figure out the ASP.NET identity matrix and how it comes in effect. I am posting this since quite often we need to troubleshoot security related issues on a production website and making any Application level changes become really difficult. What you can do now is to create a…

6

System.CodeDom.Compiler error!

Got an interesting one today… Customer had a Windows 2000 box and lots of websites. Everything use to run fine till a moment when they started getting the following error out of the blue. Interestingly, recycling the Application pool would solve this problem every time. =============================Server Error in ‘/AppName/SomeApp’ Application. ——————————————————————————–Cannot execute a program. The…

6

Troubleshooting Cookies – A Case Study

A few days ago, one of my colleagues asked a very simple question… “Do we have any document which talks about Cookies from the troubleshooting perspective in general?”. I was pretty amused for some reason and I thought okay, let me give you a detailed answer… Then I thought, okay… may be I should blog it…

7