Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Archive for May 7th, 2008

Quickly check if you’re logged in as Administrator

Posted by ken zheng on May 7, 2008

If you need to quickly tell if the person currently logged onto a PC is a local administrator of the Windows server, right click on the START button. If you see “Open All Users” rather than just “Open,” the account is in the local Administrators group.

 windows-admin.png

Posted in Handy Tips | Leave a Comment »

Recover Windows Server 2003

Posted by ken zheng on May 7, 2008

I accidently deleted a unsaved file for VPC, so when I start the VPC get: the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM

The following steps I did to get windows running for data

 1. Insert the Windows XP startup disk into the floppy disk drive, or insert the Windows XP CD-ROM into the CD-ROM drive, and then restart the computer.
Click to select any options that are required to start the computer from the CD-ROM drive if you are prompted to do so. 
2. When the “Welcome to Setup” screen appears, press R to start the Recovery Console. 
3. If you have a dual-boot or multiple-boot computer, select the installation that you want to access from the Recovery Console. 
4. When you are prompted to do so, type the Administrator password. If the administrator password is blank, just press ENTER.
5. At the Recovery Console command prompt, type the following lines, pressing ENTER after you type each line:
md tmp
copy c:\windows\system32\config\system c:\windows\tmp\system.bak
copy c:\windows\system32\config\software c:\windows\tmp\software.bak
copy c:\windows\system32\config\sam c:\windows\tmp\sam.bak
copy c:\windows\system32\config\security c:\windows\tmp\security.bak
copy c:\windows\system32\config\default c:\windows\tmp\default.bak

delete c:\windows\system32\config\system
delete c:\windows\system32\config\software
delete c:\windows\system32\config\sam
delete c:\windows\system32\config\security
delete c:\windows\system32\config\default

copy c:\windows\repair\system c:\windows\system32\config\system
copy c:\windows\repair\software c:\windows\system32\config\software
copy c:\windows\repair\sam c:\windows\system32\config\sam
copy c:\windows\repair\security c:\windows\system32\config\security
copy c:\windows\repair\default c:\windows\system32\config\default
 
6. Type exit to quit Recovery Console. Your computer will restart.

http://support.microsoft.com/kb/307545

 

Posted in Uncategorized | Tagged: | 1 Comment »

Use applicationSettings in web application

Posted by ken zheng on May 7, 2008

Most time you need to use a property in your class project. .Net has made it very easy.

For example you have MyDemoWeb Project and a class library called MyClass.

Create a app.config file in MyClass, add setting in Properties, choose Application Scope.

Don’t View Code otherwise it will generate a setting.settings.cs file. Go to the properties of Settings.settings, replace “PublicSettingsSingleFileGenerator” in custom tools. Build the project.

Now open web.config & app.config,

Copy

        <sectionGroup name=”applicationSettings” type=”System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ >
            <section name=”MyClass.Properties.Settings” type=”System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ requirePermission=”false” />
        </sectionGroup>

in your <configSections> section of your web.config

and   put following in <configuration> of your web.config

<applicationSettings>
    <MyClass.Properties.Settings>
      <setting name=”FullName” serializeAs=”String”>
        <value>Ken Zheng</value>
      </setting>
    </MyClass.Properties.Settings>
  </applicationSettings>

Then in your code write l

blProperty.Text = MyClass.Properties.Settings.Default.FullName;

You Can download example code from

http://cid-5e2b95139edcd772.skydrive.live.com/self.aspx/CodeExample/MyDemoWeb.rar

Posted in .Net, VS2008 | Tagged: | Leave a Comment »