Pages

Monday, June 7, 2010

ASP.NET and SQL Server: Chapter 1: Displaying A Gridview of SQL Server Data

Chapter 1.
Assuming you already have data you wish to display in your SQL Server database, create an aspx ajax web form.

Now open the Database Explorer, and open your database, then navigate to the table you want to show in the web form.  Click the table, and drag it to your form div tags.
Hit control-s (save) and your datagrid will appear in the design view window along with a SqlDatasource.

That was easy!  As a bonus, there are some handy easy-formatting options.  Click the grid in the design view, and look for the little pop-out menu at the top right of the control.  Select AutoFormat.
The Auto Format options can configure all the visual settings for you in a flash.  This menu is also used to select editing, paging, sorting options for the gridview.

Press F5 to view the grid in action.  Then stay tuned for Chapter 2: How to use a dropdown list in the grid.

Friday, June 4, 2010

How to Design a Crappy Web Site

Ok, no one really needs information on how to make the worst possible web site.  This article was written as a guide how not to do a web page for your business.  As a professional web designer I am well-versed in all the nerdy ways required to carve a web site out of solid stone.  What I offer here is a humorous attempt to get you thinking about the things a business needs to consider before creating or redesigning your web page.

First, have no idea what you want to say.
After all, you hired a professional programmer... He should just know what you need to put on the web to take your sales profile from zero to hero.  Right?!?  He can just make it all searchable, sortable, buzzwords that hypnotize viewers into cranking out that credit card.

Next, have no goals in mind for your site.
When your web designer asks questions like "What are the goals for this site, to generate phone calls, foot traffic, direct Internet sales, gathering club members?", make sure that you don't have a good answer to that.  Tell him something vague like we just want sales.

Content is overrated.
Your web designer is a trained professional.  He should have access to all the photos, text, articles, and everything that he needs to make your site.  It's far too much work to make a list of pages and mock them up in Word for him.  Besides, thats how he earns his keep, right? 

Photos
Make sure any site photos you provide are a little blurry, an unreasonable size (like 30,000x22,000 pixels), in an antiquated image format (daguerreotype if possible), badly lit, and full of really ugly people against distracting backdrops.  If possible, take these near your competitors billboards and other signs.

Speak in generalities and marketing lingo about layout.
When your web designer asks what colors, themes, and logos you want to use, give him a description of feelings, couched in marketing weasel words.  He may expect things like "We'd like a 3 column layout in mauve and yellow with this banner and our company logo.  We'd like a button menu across the top, our sales ads in the center,  and an RSS feed of our blog articles in the right column.", but do NOT tell him that.  Say things like, "We are committed to challenging unquestionable management leadership with expansion through opportunities overcoming all obstacles."  You know, try to avoid the mention of colors, layout terms, and anything that can actually be used to - I don't know - figure out where to put stuff on a screen.


Web Design is an iterative process.
So every time your web designer sends you an email asking you to approve something here's what to do.
  1. Wait 4 to 12 days before responding.
  2. When you do call, ask why it's going so slow.  Say things like "I thought you said you were good at this."
  3. About the work you're reviewing, respond with more generalities like, "I was thinking of something more youthful and clean.
  4. It's more fun to wait until the second time around to show him examples of what you're looking for, but throw in a few spoilers you hate - it makes the job of looking for a common thread more fun!
  5. Wait until the fourth go-around before you mention the name of an actual color or pattern.
  6. Try to keep the process going forever.  This is all part of the initial quote, right?
Advertising
Don't set aside any money for advertising your site. A good web site will become popular even if you never tell anyone it's there.  Sales will just flow in, even if you never really gave enough information to let people know how to buy.  Don't integrate with tools to help you track your traffic and link to your sales.   Either it will work and you'll sell like crazy, or it won't, in which case it was the web designers fault.  It's a no-lose scenario!


Going forward
Once your site goes on-line, it's important to let your web designer know that your hits are not increasing, and you're not making many sales.  Even if you're up 4% with no advertising, you were expecting 20%.  Try to use this guilt to get the designer to "fix" his "broken concept" for free as a defect, rather than pay him to "redesign" the site.


In Contusion...
Seriously, think of your web designer like you would think of a printing house you use to create a catalog or magazine.  A good one is very qualified to take your ideas and present them on the World Wide Web in a way that will help you achieve your goals.  You would never expect a printing house to take photos or write copy, or even to create a corporate image for you.  You should not expect this of your web designer either.

Tuesday, June 1, 2010

No connection could be made because the target machine actively refused it

This happened after migrating from a T1 line to a Comcast 10Mb line.   My web sites can no longer send emails because of this error. 

My setup:

I am using SBS 2003 as a web server AND as an Exchange server.  The ASP.NET code that is trying send an email looks like this:

   1:      protected void Button1_Click(object sender, EventArgs e)
   2:      {
   3:          if (IsPostBack)
   4:          {
   5:              MailMessage myMessage = new MailMessage();
   6:   
   7:              myMessage.To.Add(new MailAddress("myAddress@gmail.com", "Me"));
   8:              myMessage.Subject = Regex.Replace(Subject.Text, @"<(.|\n)*?>", string.Empty);
   9:              myMessage.ReplyTo = new MailAddress(email.Text, name.Text);
  10:              myMessage.Body = Regex.Replace(messagebody.Text, @"<(.|\n)*?>", string.Empty);
  11:   
  12:              SmtpClient MailMan = new SmtpClient("209software.com");
  13:              MailMan.EnableSsl = true;
  14:              try
  15:              {
  16:                  MailMan.Send(myMessage);
  17:              }
  18:              finally
  19:              {
  20:                  ;
  21:              }
  22:              
  23:          }



Diagnosis:
In my case, we had switched from a T1 to a 10Mb line.  everything was configured the same but we *did* get a new IP address, which we changed in the server appropriately. HOWEVER. on this new line, provided by Comcast, hitting our IP address from inside the network gets redirected to Comcast Business Gateway.  Let me demonstrate.   From the outside world, my website looks like this:


However, when I remote into my server, I see this:

Somehow the Comcast Business Gateway is intercepting hits to my IP Address from inside the network.  This causes all requests from my ASP.NET applications to email stuff using my Exchange server to go not to my server, but to this Comcast monstrosity.

The Solution:
What I did was so simple - I am embarrassed to say it took me overnight to think of it.  I logged into the webserver and added all my websites to the HOSTS file (C:\windows\system32\drivers\etc\hosts) like this:

127.0.0.1 209software.com www.209software.com mail.209software.com
Now my server can access itself when it needs to.  BTW This is a very lame approach on the part of Comcast.  I officially hate it.

Share This!

Contact Us

Name

Email *

Message *