Technical

Difference between 3 tiers and 3 layers applications

The terms tier and layer are frequently used interchangeably, but actually there is a difference between them: Tiers indicate a physical separation of components, which may mean different assemblies such as DLL, EXE, etc... on the same server or multiple servers; but layers refers to a logical separation of components, such as having distinct namespaces...

Captcha image in C#.NET

What Captcha stand for? Completely Automated Public Turing test to tell Computers and Humans Apart. The Captcha technology help you to make sure your site is reasonably secure against automated attacks. Write the following code in a class named Captcha: public class Captcha { //make the captcha image for text public Bitmap MakeCaptchaImage(string txt, int width, int hight,...

The difference between Server.Transfer and Response.Redirect in ASP.NET

Server.Transfer processes the page from one page directly to the next page without making a round-trip back to the client's browser. This way is faster, with a little less overhead on the server. However, it does not update the clients URL history list or current URL. Response.Redirect, as expected, is used to redirect the user's...

Make previous calendar dates not selectable in ASP.NET

In order to make all dates before the current date, not able to be selected, in the onDayRender event for your Calendar: if (e.Day.Date < DateTime.Today) { e.Day.IsSelectable = false; } To make it more obvious to the end user, also add: e.Cell.BackColor = Drawing.Color.GhostWhite; e.Cell.ForeColor = Drawing.Color.Gainsboro;

Get the referring page on Page_Load event in ASP.NET

When a page loads, in order to get the name of the page that sent you there, all you need to use is: Request.UrlReferrer.ToString(); You can create a global variable to hold it: string sReferrer = ""; Then, in the Page_Load event, assign it: if (!Page.IsPostback) { sReferrer = Request.UrlReferrer.ToString(); } Or, you can put it in ViewState at...

Confirmation message upon deleting an item from GridView control in ASP.NET

Lots of users click the delete button within the GridView with no attention then the result is that the item will be deleted from the GridView, so we can add confirmation message to appear to tell the user "Are you sure you want to delete this item?". First of all we have to attach the javascript code...