Skip to main content

Posts

Open source Content editor

As most of the website these days have dynamic content, you need a good content editor. I have used this FCKEditor (http://www.fckeditor.net/). Here are few godd reasons to use it. 1. You can customised the toolbar to your need. 2. It is same functionality as MS Word. 3. Open source and hence free. 4. Cross browser compatible. 5. Cross platform compatible. 6. Available for multiple enviroments like .Net, php etc. Last but not the least....it is very simple to use. Raj

Importance of Namespace

Recently I have been developing a content managed website. The website worked fine on my machine (I can see developers grinning there!). The problem started when I published this website on a live server. It started giving out strange error like "no code found at line..." and it was pointing a dll in a temporary file in .Net framework folder. After some investigation, it turns out that my class names were clashing with others. I renamed the classes and class files and it sorted the problem. A proper solution to this would be to define you own namespace and make sure all the classes are within that namespace. This is also important if you are deploying website on shared server. Raj

Paths in asp.net

When working with resources in a Web site, you must often specify a path for the resource. For example, you might use a URL path to reference an image file in a page or the URL of a page elsewhere in the Web site. Similarly, code in your Web application might use a physical file path to a server-based file to read or write the file. Client Elements Elements that are not server controls on a page are client elements. There are two ways for specifying a path in client elements. A. Absolute path An absolute URL path is useful if you are referencing resources in another location such as an external Web site. For E.g. <img src="http://www.yourwebsite.com/MyApplication/Images/SampleImage.jpg" /> B. relative path Site Root relative path A site-root relative path, which is resolved against the site (not application) root. This example path assumes the existence of an Images folder under the Web site root: For e.g <img src="/Images/SampleImage.jpg...

Files in a ASP.Net project

Solution (sln) file. Solution user Options (.suo) file. Project configuration file (.vbproj) or .vcproj file .aspx, .asmx, .ascx .aspx.vb or .aspx.cs - code behind fiels globax.asax resouce file .resx other files .txt, .rpt style .css files congig file web.config. discovery file .disco or .vbdisco Project Assembly files (.dll)—All of the code-behind files (.aspx.vb and .aspx.cs) in a project are compiled into a single assembly file that is stored as ProjectName.dll. This project assembly file is placed in the /bin directory of the Web application. AssemblyInfo.vb or AssemblyInfo.vb or AssemblyInfo.cs—The AssemblyInfo file is used to write the general information, specifically assembly version and assembly attributes, about the assembly.

Application domain restart

There are several conditions that will cause an application domain to shut down and restart. When ASP.NET must restart an AppDomain, it simply removes the entry in the table that points to the AppDomain. When a new request arrives, the table does not have an entry; therefore, ASP.NET creates a new AppDomain that handles all of the future requests. The old AppDomain continues running until it completes all of its current requests. Finally, the old AppDomain shuts down. The following changes will cause an AppDomain to restart: Configuration change—If the machine.config or Web.config files are changed, ASP.NET detects the change and restarts the affected AppDomain. Global.asax change—If the global.asax file is changed, ASP.NET detects the change and restarts the affected AppDomain. Bin directory change—If an assembly in the bin directory is changed, ASP.NET restarts the AppDomain that corresponds to that bin directory. Compilation count change—When an ASP.NET Web page is changed, it is re...

R.I.P Visual Basic

Are Visual Basic days numbered? Over last few weeks I have been hearing that Microsoft is going to stop supporting Visual Basic at some point in future. C# is the language of future. Here, according to some, are few evidences of it. 1. There are new versions of C# but no major development in VB.net 2. Microsoft uses C# for example in most of the articles/journals. Do a quick search on "VB.Net a dead language" and you will find some interesting article. I would like to hear your views on this. Personally I think C# is a much better language than VB.Net even though most of my experience has been in VB. The syntax of C# is much more clear and easy to understand. I must say I am converted and given a choice I will prefer coding in C#. DebugGuru

Sharing code across multiple pages/ web applications

There are times when you will want to share code across several pages in your site. There are 3 ways of doing it. 1. The code directory (APP_CODE). Just copy your .vb or .cs file in app_code and it will be dynamically compiled. 2. Local assembly (BIN directory). Compile your code and copy the dll file in BIN. 3. Global Assembly Cache. You can register a strongly typed assembly using regasm.exe. Alternatively you can register a assembly using web.config I will explain each of these in details in my next few blogs. DebugGuru

Shared code in multiple languages.

By default, the App_Code directory can only contain files of the same language. However, you may partition the App_Code directory into subdirectories (each containing files of the same language) in order to contain multiple languages under the App_Code directory. To do this, you need to register each subdirectory in the Web.config file for the application. <system.web> <compilation> <codesubdirectories> <add directoryname="CSharpCode"> <add directoryname="VBCode"> <add directoryname="CPPCode"> </codesubdirectories> </compilation> </system.web> </configuration>