December, 2012 browsing by month


Downgraded Windows 8 to Windows 7, be careful

Thursday, December 27th, 2012

Recently I purchased a Lenovo ThinkPad T430 loaded with Windows 8 64 bit. A few days later I tried to downgrade Win8 to Win7 in order to be consistent with my company’s standard which is currently Windows 7; I thought it would be easy – just pop in the Windows 7 CD and let it delete the old partition and create a new NTFS partition, then install the Windows 7 32-bit. Well, yes, it did delete the partition where Win8 was installed. But I was unable to reformat it to NTFS that is required to install Windows 7. Windows 8 is only installed on GPT (Guid Paritition Table) format; at that point, I was basically in a limbo – I could not go back to Windows 8 because the GPT partition was deleted and was unable to install Windows 7 because it requires NTFS. Eventually, I got someone from Lenovo Community Forums to point me to using a DOS utility called DISKPART. With that, I have successfully overcome the biggest hurdle – re-partition my disk to NTFS format. Here I recorded the steps I just went through ( I also posted these to Lenovo Community Forums), hoping it will be useful to someone who might want to do the same:

  1. Powered up T430 and let the Diagnostic tool run “Preparing Automatic Repair”
  2. On screen showing “Diagnose your PC” then “Attempt to repair your PC”
  3. Automatic Repair failed, then two options button showed “Shutdown” and “Advanced options”; selected the “Advanced options” button
  4. Selected “Troubleshoot”, then “Advanced Options”
  5. Clicked on “Command Prompt” on Advanced Options screen
  6. Now we are in command prompt: c:\>; typed “diskpart /?” to list a possible commands
  7. Followed the instruction on to get the proper command switch
  8. At C:\> typed “diskpart” to enter DISKPART command mode; then type ? to list all the switches, such as GPT, Help, etc
  9. Diskpart>format fs=NTFS Label=”86DB-AC90″
  10. Did not format; message returned
    There is no volume selected.
    Please select a volume and try again
  11. As matter of fact, the problem was that I had not selected a disk; after reading this post at Diskpart-to-Create-and-Format-Partitions.aspx, I did a “list disk” command at DISKPART>, and that got me a list of disk online.
  12. Then I did a select disk command: DISKPART>select Disk 0; it returned message “Disk 0 is now the selected disk”
  13. I ran “clean” command again; this time, message returned, “DiskPart succeeded in cleaning the disk”
  14. Diskpart>format fs=NTFS quick; still got the “There is no volume selected”
  15. Tried DISKPART>convert mbr
    DiskPart successfully converted the selected disk to MBR format
  16. DISKPART>create partition primary
    output: DiskPart succeeded in creating the specific partition
  17. DISKPART>select part 1
    output: Partition 1 is now the selected partition
  18. DISKPART>format fs=NTFS label=YangT430 quick
  19. Put in Windows 7 32-bit CD and installation now just sailed through.

Asp.Net Form Postback error:Error – Operation is not valid due to the current state of the object

Wednesday, December 12th, 2012

Sometimes when there are a large number of input fields on a Asp.Net form, and doing postback, I would get this error:
“Error – Operation is not valid due to the current state of the object”

As it turned out there is a restriction on how many fields can be posted back to server and the large grid that contains a large number of textbox fields probably was the culprit. Google search returned some postings that all point to the configure setting

<add key=”aspnet:MaxHttpCollectionKeys” value=”2000″ />


After I stuck this line into the appSettings, the problem went away.

Smtp Permission error at Winhost

Friday, December 7th, 2012

When I was developing my ASP.Net app on local machine,  I had no problem sending email by calling directly the SMTP relay server assigned by my hosting company Winhost, with port set to 587 of course. But when I deployed the app to the winhost server, the email tool threw this exception :

Request for the permission of type ‘System.Net.Mail.SmtpPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.

I did suspect some some security permission to Smtp related assembly and have done some search toward that direction. First I got a lead from some post via Google search and one suggested added this entry into the <system.web> section; but that did not work, so I am not going to give reference to this post.

<trustLevel name=”Full” policyFile=”internal”/>

Today, I went into Windost support site and did another search on their forum, and they pointed me to using this instead:


<trust level=”Full” />


Yes, that was all it needed!

Setting up Elmah SQL Server objects manually

Tuesday, December 4th, 2012

1. Run Elmah.axd on localhost and got this error,”Could not find stored procedure ‘ELMAH_GetErrorsXml'”.
What happened was that the Elmah sql objects were not installed properly when I run NuGet package-install elmah from inside VS2010 IDE.

2. Remedy was downloading the elmah-1.2-db-sqlserever.sql script from here
4. Open SQL Server 2008 Management studio and connected to the remote database hosted at Winhost
5. Opened the Elmah db sql script file and executed it on the remote database.
6. Now returned to localhost/Elmah.axd and error log is showing.