Scott Hanselman

Glory be, my MSDN Article is up

November 25, 2003 Comment on this post [1] Posted in ASP.NET
Sponsored By

After a few small logisitical snafus my article on back-porting cross-site-scripting from ASP.NET 1.1 to ASP.NET 1.0 is up at Kent Sharkey's ASP.NET section on MSDN.  Thanks Kent!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

I'm late but: How I got into Computers

November 21, 2003 Comment on this post [3] Posted in Musings
Sponsored By

This is late, as many others have already shared their stories, but here's the short story on how I got into computers.

In the neighborhood I grew up in, I was apparently be labeled "at risk."  Probably would have been vote most likely to be convicted of a white-collar crime.  One day there was some kind of parent-teacher-school district superintendant meeting and they decided if we don't give this kid something to do, we're going 'lose him.'  So, my fifth grade teacher let my dad and I borrow the Apple II computer over the weekends.  I started using friends' TI89/A's and spent more than one weekend typing and printing a 20 page (20 pages of 8x11 ASCII ) poster of Mister Spock on a TRS/Trash80.

Then, a few months later, the parents sold our van to buy me a Commodore 64, and a few copies of COMPUTE! magazine pretty much insured I'd be indoors for life.

Fast forward 5 years (various operating systems I used described here in an earlier unrelated post) and I was selling my services (which consisted of a complex 'document recovery' racket at local high schools [né 'business'] as Tweak Inc. running entirely off a single copy of Norton Disk Doctor).

Fast forward a few more years and I was running Tweak Computer Support and BBS and programming Win16 apps in C.

Fast forward a few more years and I sell Don Box a Newton on opening day

Fast forward a bit more and you can find me posting on USENET from nike.com.

Fast forward <10 years and I'm working at Corillian Corporation and blogging with you fine people.  And it all started with my fifth grade teacher letting me type 'CATALOG' into an Apple II.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

ASP.NET: Postbacks for Algernon

November 21, 2003 Comment on this post [2] Posted in ASP.NET | Javascript
Sponsored By

We're hip deep into this bank today.  Doing some amazing stuff and making a very rich user experience with as few moving parts as possible.  Reuse, Reuse, Reuse.

Here are some interesting things I've learned/been reminded of

  • Pretty PostBacks when using RewritePath: When you call HttpContext.RewritePath to make “junk.aspx?specialparam=Y“ look like “someotherpage.aspx“ it will look nice in the Browser's Location Bar, but not in the Form Action.  Consequently, when you postback, you'll see the ugly URL in the Browser's Location Bar.
    • So, call Page.RegisterStartupScript with this little block:

      Page.RegisterStartupScript("rewritepathfix","<script language='javascript'>document.YourFormNameHere.action = document.location.href;</script>");
  • Complex Custom Confirmation Dialogs on LinkButtons in DataGrids while STILL maintaining PostBacks (whew!): If you want to have a javascript:confirm() dialog popup when clicking on a LinkButton (not a Button), BUT you want the javascript dialog to contain a context-specific message based on data, AND you still want a PostBack event to occur:
    • Chain the JavaScript events by grabbing the LinkButton in the Grid's ItemDataBound.  Make a parallel HyperLink with an onclick that contains your javascript confirm, THEN the PostBack javascript, which can be got to via Page.GetPostBackEventReference.  In this example the function GetConfirmJavascript builds a confirm(”yada yada”) string based on the object passed in.

      public void GridDataBound(Object sender, DataGridItemEventArgs e)
      {
         if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
         {
            string target = string.Empty;
           
      HyperLink linkCancel = new HyperLink();
         
         LinkButton linkButtonCancel = (LinkButton)e.Item.Cells[CancelColumn].FindControl("LinkButtonCancel");
            linkEdit.Text = linkButtonEdit.Text;
            target = Page.GetPostBackEventReference(linkButtonEdit);
            linkCancel.NavigateUrl = GetConfirmJavascript(e.Item.DataItem as MyObject, target);
            linkButtonCancel.Visible = false;
            e.Item.Cells[CancelColumn].Controls.Add(linkCancel);
         }
      }

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

My Ultimate TabletPC

November 19, 2003 Comment on this post [4] Posted in Musings
Sponsored By

It's out and here's the scoop.

  •   Intel® Centrino™ Mobile Technology
  •   Microsoft® Windows XP Professional Tablet Edition
  •   Microsoft® Office OneNote™ 2003
  •   High resolution 12.1" SXGA+ (1400 x 1050) display*
  •   Up to 4.34 hours² battery time
  •   NVIDIA® GeForce™ FX Go5200 32M graphics w/32MB DDR memory
  •   Integrated Wi-Fi™ (802.11b), 10/100 Ethernet, V.90/56K modemº

It's got a 1.5Ghz Processor and up to a Gig of RAM.  Note that they wimped out on the 128Megs of RAM, but it DOES HAVE 1400x1050 RESOLUTION!

Sold. I mean, Bought.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Brainfart? or ASP.NET madness

November 19, 2003 Comment on this post [4] Posted in ASP.NET
Sponsored By

I need a function from ASP.NET that gives me, reliably and guaranteed, without a config file, the base virtual directory of the current website.  So if I'm in c:\inetpub\wwwroot\web (ne http://localhost/web) then I want “/web/.” 

But (here's the fart part) I can't seem to find a way that gives it to me INDEPENDANT of the current Context's path.  Meaning, if the VERY FIRST (app start) page hit on the site is http://localhost/web/balances/balances.aspx then I still need “/web/“ not “/web/balances/.“

This is the closest I've got:

return HttpRuntime.AppDomainAppVirtualPath + "/";

However, this appears to occasionally (read: flaky) return a different path like /web/images/ or /web/someotherpagedirectory. 

What am I missing?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.