Assigning Session to nothing or Session.Abandon

I have seen so many developers once they wanted to destroy session, they used

Session(“A”) = Nothing

Its not a good practice to assign nothing object.

Correct:

 

Session.Abandon

 

The Session.Abandon method basically destroys a user session.

One thing I would add the current Session object will not delete untill the script on the current page have been processed completely.

Sorry for your inconvience, I have my official blog please visit for complete article:

http://blog.joggee.com/?p=143

 

 

 

 

 

Advertisements

TODO Comments

Please check the detail with my official blog

http://blog.joggee.com/?p=135

 

 

ASP.Net – Global.asax not firing

“I am experiencing problem with global.asax; events are not firing, I cant debug global.asax” One of my reader asked me.

Simple and reliable solution is.

Remove global.asax from your project and add again and leave in on the root of the project.

Since we are using ASP.Net 2.0 there is no Global.asax file in visual studio solution by default.

This will solve the problem, Global.asax

Rana

StripHTML function

If you know the meaning of Strip word you will know what does it do.  just kidding 🙂

The StripHTML function removes all HTML code from a string.
Syntax:
string = StripHTML(string)
Example Usage:
<%
dim a

a = a & “<HTML>” & vbCrLf
a = a & “<HEAD>” & vbCrLf
a = a & “<TITLE>Rana’s Blog</TITLE>” & vbCrLf
a = a & “</HEAD>” & vbCrLf
a = a & “<BODY>” & vbCrLf
a = a & “-Code Project!!!” & vbCrLf
a = a & “<A href=”” mce_href=””./Rana.asp””></A>” & vbCrLf
a = a & “</BODY>” & vbCrLf
a = a & “</HTML>” & vbCrLf

response.write StripHTML(a)

%>

Output
Rana’s Blog – Code Project

One of my reader asked me how to do in ASP.NET 

In ASP.NET you can strip the HTML using Regex

Dim StrStripped As String

StrStripped = System.Text.RegularExpressions.Regex.Replace(“Input as String”, “Pattern like (.|\n)*?”, String.Empty)

ASP.NET TODO Comments

Using TODO, HACK, and UNDONE Comments
TODO comments is really useful command. When you begin a comment with ToDo or TODO or however you want to capitalize it, you can then see this comment in your task list by changing the task list options. This is very useful for marking parts of your code that you later need to work on. By default, there is also a HACK and UNDONE comment that I use from time to time. You can add comments that can be seen on the task list by going to Tools->Options, then under the environment folder select Task List.

‘Todo: Missing parameters need to be pass.