Wednesday, June 30, 2004

If you have different versions of your web application built for different languages and you have seperate resource files for each language when you need to deploy your application according to the language settings of the server then in that case make an Installer that has Custom Action to install only location-specific files...

Tuesday, June 29, 2004

If you have a common server where you are going to host your website and you do not want anyone to override your configuration settings after the site is deployed then within your web.config file, use &ltlocation&gt tag and set allowOverride attribute to false....

There are few more points which I can recollect but I think that this is enough for a tip... If anyone needs more info do write back to me... :-)

* pure virtual method is a method which has just definition but not implementation...

PS: Many of us work on weekends, I don't think (current thought!!) that its a good practice doing that, atleast if you are being guaged on the basis of your willingness to work on weekends then its surely very bad... I am trying to start a movememt to abolish this social evil of working on weekends, so no tips on weekends...:-)
BONUS TIP: Spend time with your family this weekend... :-)

Thursday, June 24, 2004

You cannot call static method of a class using the object of the class*... You would have to call it using the Class name itself..
eg.You cannot call base class's static method using base.StaticMethod(); that shall result into an error...

the way you do it is:
//Class having Static Method
public class MyClass
{
public static string StaticMethod()
{
return "Vishal_Joshi@MVPs.org";
}
}

* This is applicable only to C# in case of VB.Net you can access static methods even using the object of the class... (This is what happens to a C# fan.... Thanks to Jacob Cynamon, MS and Kathleen Dollard, MVP for reminding... )

Wednesday, June 23, 2004

A static member of a class can be accessed without creating an instance of the class... Everyone knows this right!! so what next...??
A static member cannot be marked as abstract or virtual, trying to do so will result into an error...
Inside a static member you cannot call any non-static member, trying to do so will also result in an error...

Monday, June 21, 2004

You might have many errors handled in your application but still there would be few of them always left out, so what's the solution??... Well here it is... Go and do the setting in the web.config file of your web application...
&lt customErrors defaultRedirect="UrProblemUnknownError.htm" mode="RemoteOnly" &gt
&lt error statusCode="404" redirect = "MyProblemServerNotFound.htm"/&gt
&lt /customErrors &gt

Now interesting fact is in conjunction to our previous tip on "SmartNavigation"... In case of pages for which you allow SmartNavigation the defaultRedirect does not work and Microsoft has confirmed it to be a bug... At the same time there is a work around...
Change your page directive a little bit when you use "SmartNavigation" as follows

Thursday, June 17, 2004

"SmartNavigation" is a boolean property which can be set in the page's code behind or in the @page directive... This property is really helpful in case you want to enhance user experience... Set this property to true and you will get following advantages in navigation if your browser is IE 5.5 and above...
1.) Maintaining the scroll bar position (useful in long length pages)
2.) Set focus to the same control on which it was before navigation (useful in pages with lots of controls)
3.) saving last page state in the browser history (useful when a page does not changes considerably across frequent postbacks... eg chaning control values on change of dates in calendar control)
4.) The flash effect caused during navigation (useful when your page is pretty heavy to load)

Wednesday, June 16, 2004

Whenever Response.Redirect line is executed the browser gets a HTTP staus code of 302 from the server indicating it to GET/POST again to the new URL provided... This means that the page does one more round trip to the server with different URL... Most of the browser use GET request to comply with HTTP standards and if they use POST then they would have to prompt the user for permission... In anycase there is a performance hit of posting twice... Most of the cases it is not visible to the user...

If you are very high on performance then use Server.Transfer instead... Also note that your form variables are not available in the next page in case of Response.Redirect; in case of Server.Transfer the data submitted by the user is preserved...

Well I think this is long enough for a tip, so rest of the info I will include in a small article...

Tuesday, June 15, 2004

"AlternateText" property in the Image control is for narrator to read when a disabled person is trying to access the page via Narrator... Remember this when you are trying to develop an application for disabled people as well...