Posts By Category

Posts By Date

Resources:

C# Books
ASP.NET Books DotNet4All








If you like to support this site, feel free to make a donation to support improvements.

Thank you!

Monetize Your Blog

A C# Algorithm to calculate the best way to cut small pieces of paper out of a larger piece

This is a project I worked on last year. It is an algorithm to to show the best way to cut small pieces of paper out of a larger piece. I wrote the algorithm in C# then used System.Drawing.Imaging to to demo its output on an ASP.NET page.

The project is also available as an iPad/iPhone app, named Smart Cutter.

Continued...

ASP.NET GridView

When you bind a GridView to an ObjectSource in ASP.NET, sometimes, you don't want to display all of the columns returned from the ObjectSource DataTable, but if you use a GridView and let it autmatically generate the columns, it becomes not a striaght forward deal to hide the individual selected columns. Here is a way to do that:

Simply catch the RowDataBound event on the GridView and if you know the index of the column to hide, just use it as follows:

Continued...

Using HttpRuntime to get the web application absolute path

We all know in ASP.NET, to get the absolute path from the relative path, you can prefix your relative path with the Tilde character as follows:

MyHyperLink.NavigateUrl = "~/Catalog/ASP/Products";

Continued...

A free user control to hold the social links icons in ASP.NET

Do you like the social links bar on top of this article? Do you hate it? In today's internet blog, you almost never miss seeing a "Digg It", a "Kick it", a "Ridd It" a Furl it, burl it...or squirrel it... link or icon at the end of each article you read in someone's blog. Well, regardless of the opinions people might have about this phenomenon, if you are an ASP.NET programmer like me, your concern would probably be over how to construct the "social-butterfly" user control, rather than

Continued...

Programmatically send emails using Google mail server and System.Net.Mail.SmtpClient

Did you know you can use your gmail mail server to send and receive emails programmatically for free?

Continued...

Track your visitors IP & Host Info, but make sure to catch any exceptions

In my previous article, How to track visitors to your site in ASP.NET & C#, I discussed how you can log the Host Info for each page visitor on your site using Dns.GetHostByAddress function.

One thing I did not stress out was the need to catch all exceptions from that method call. There are cases when this call:

Continued...

Code to log the IP address & DNS name for visitors to each page

Once you have published a site in ASP.NET, you'd like to know who are your visitors. One way is to check your event log on the host server. Another option is to write your own code. You'd basically like to log the IP address, and DNS name for the visitor, and it would be nice to know which page they are visiting.

To log the ip address using ASP.NET, you can call:

Continued...

Code to log the IP address & DNS name for visitors to each page

Once you have published a site in ASP.NET, you'd like to know who are your visitors. One way is to check your event log on the host server. Another option is to write your own code. You'd basically like to log the IP address, and DNS name for the visitor, and it would be nice to know which page they are visiting.

To log the ip address using ASP.NET, you can call:

Request.ServerVariables["HTTP_X_FORWARDED_FOR"]

Continued...

Copyright © 2007 Yousef Mannaa. All material on this site is copyrighted.
Do not publish or reproduce any of this material without written permission from the Author