Category Archives: Uncategorized

How do I create the aspnetdb database?

I’ve been using the Microsoft Aspnetdb database for some time now, and I still get asked about how to create the database, so here you go enjoy:

Microsoft has a new and powerful default database schema in ASP.Net 2.0 as ASPNETDB.mdf database. This database file serves as a role provider, and membership provider. Visual Web Developer 2005 supports the ASP.Net configuration to manage this personal aspnetdb database file within the web application inside the App_Data folder. Aspnetdb database helps in managing users along with their roles e.g. admin, employee, editors etc. It also enables the in-built functionality of Login controls and web parts to be integrated on ASP.Net 2.0 web pages that helps in managing user profiles, login, and personalized user pages very easily even without writing the bulky code to implement the sql queries or stored procedures along with data access code for inserting, updating or deleting the user personalized data.

How to create Aspnetdb database?

Using aspnet_regsql command:

You can use aspnet_regsql command to create aspnetdb database. This command executes the default scripts to create the default database for asp.net 2.0 web applications.

Steps to create aspnetdb database using aspnet_regsql command:

  1. Open the Visual Studio 2005 command prompt from Start –> All Programs –> Microsoft Visual Studio 2005 –> Visual Studio Tools –> Visual Studio 2005 Command Prompt
  2. Type aspnet_regsql and press enter key 
  3. This will open the ASP.Net SQL Server Setup wizard. Click next to continue… 
  4. In the next screen select the option to Configure SQL Server for application services. This option executes a script to configure the database for managing user profiles, roles, membership and personalization. Click next to continue…
  5. In this step enter the sql server name and choose the right authentication method. Leave the database field to default and click next… 
  6. Confirm your settings and click next to finish. 

It’s also worth checking out:

How to Collaborate with Remote Employees

I’ve been working at home on and off for a number of year, and one thing that always comes up is how to collaborate with remote employees over the internet.

I have been using Microsoft Shared View, it’s easy to use and just does the job.  If you are using a Mac then you could also try out Microsoft Shared View for the Mac, although I have not tested this out yet.

It’s also worth check out How to Collaborate with Remote Employees with Office Communicator 2007 R2 by Scott Hanselman, for other ways for collaborate.

ASP.Net MVC Custom Error Pages

Now that I’m using MVC fully it’s time to implement a Customer Error Page.

As ASP.NET MVC is a layer on top of ASP.NET we can still use the same Customer Errors that we are used to in the Web.Config, so just to make it SEO friendly, here is what it can look like:

<customErrors mode=“On“ defaultRedirect=“~/Error/Unknown“ />

 

 

http://www.genericerror.com/blog/2009/01/27/ASPNetMVCCustomErrorPages/

 

Other references worth check out are:

ASP.NET Custom Errors: Preventing 302 Redirects To Custom Error Pages

Better Custom Errors in ASP.NET

404 vs 302 ASP.Net Custom Errors

Fastest way to Screen Cast

If you need to screen cast then check out Screen Toaster, it’s fast easy to use

 

  • Register & use it anywhere, anytime
  • No download. Compatible with Windows, Mac OS X, Linux.
  • Capture videos of onscreen action in one click
  • Record screencasts, tutorials, demos, training, lectures and more.
  • Share and stream videos online in Flash
  • Embed them on blogs and webpages or send them by email.

 

Scripting SQL Objects with SQL 2008

If you need to script out the objects within a database, from generating tables through to extracting out the data so you can use it in another database or schema then you are going to need to script the SQL.

MS SQL Server 2008 has new Generate Scripts option which enables you to script data in SQL Server database tables. you can script data from sql tables into a script file, to the clipboard or script data on a new sql query window. Script data can be used to export and/or import table data from one database to another database.

The Script Data option creates INSERT statements foreach row in the table using the column data that the related table record has. Later than the scripted table data can be used by executing the generated t-sql scripts, to create a copy of the original table on an other server or an other database with identical data or identical rows on the destination database or table, what’s more you can script the the database to go to a SQL 2000 database from a SQL 2008, how cool is that?

SQL Server generate script with data is a powerful SQL Server tool in order to create sql script to move data from one database to another database.

I want to demonstrate with a sample how a sql developer can use the Generate Scripts task in order to script table data of a SQL Server 2008 database table.

Open the Generate Scripts SubMenu Item from Task Menu

First of all, open the Microsoft SQL Server Management Studio which is installed from the Client Tools of a MS SQL Server 2008 installation package.

Connect to a MS SQL Server database instance using the Server Explorer or using the Connect screen.

Then open the Object Explorer window and expand the Databases node.

Here I connected to the local SQL Server instance and clicked over the Databases node and a list of existing sql server databases are visible in the object explorer window now. Later, I clicked the sql database MyWorks which owns the tables that I want to script data, rows/records of the database.

Continue by right clicking on the database name and open the context menu, chooes Tasks menu and open submenu. Select Generate Script submenu item from the displated list.

Generate SQL Server Script Wizards

When you select the Generate Scripts sub menu item the Generate SQL Server Scripts Wizard starts. SQL administrators and sql programmers can use the Script Wizard to generate t-sql scripts as a t-sql scripter to create scripts for any object (tables, views, schemas, etc). You can work in detail on the Script Wizard and find useful hint that you can benefit in your sql developments.

Watch the following screen cast to see it in action.

 

xVal 1.0 released

An important tool when using MVC xVal version 1.0 is released, xVal is a validation helper for ASP.NET MVC that lets you use your own choice of server-side validation framework (e.g., Microsoft’s DataAnnotations attributes, or Castle Validator, or NHibernate Validaion) and dynamically generates client-side validation code from your rules.

xVal 1.0

ModelState is not Valid

When you are using MVC you will come across using the ModelState, and the most common use is ModelState.IsValid, if you’ve not used this before then check out Validating Model Data in an MVC Application or xVal – a validation framework for ASP.NET MVC, what I did come across is an exception beyound the normal checks, that a table was missing from the database.  Although the error was recorded in the ModelState, it did not raise any exception and hence the exception handling did not capture the message.  To record the Exception you’ll need to go over the collection and this code allows you to do this:

 

foreach (var value in ModelState.Values)

{

     foreach (var error in value.Errors )

     {

        throw new Exception (error.ErrorMessage, error.Exception);

     }

}

 

 

Windows 7 – things you don’t know

I’ve been playing with Windows 7 for a little while now and I am impressed it lokks like Microsoft have got it right.  I’m a power user and if it works for me I can say it is going to work for Mr Average Joe.  I’d thought I draw up a number of special features that I have found in my travels around Windows 7.

 

Problem Steps Recorder

You can use Problem Steps Recorder to automatically capture the steps you take on a computer, including a text description of where you clicked and a picture of the screen during each click (called a screen shot). Once you capture these steps, you can save them to a file that can be used by a support professional or someone else helping you with a computer problem.

To start type PSR in the Start menu search box

More details from Tech Republic

Problem Steps Recorder with Jeremy Chapman

 

ISO Burner

You now have the ability directly from within Windows 7 to burn ISO images directly to CD or DVD, if you’d like to know how to do it check out Burn ISO Images Natively in Windows 7 Burn ISO Images Natively in Windows 7

Switch to a projector

Windows 7 now provides a standard way to switch your display from one monitor to another, or a projector – just press Win+P or run DisplaySwitch.exe and choose your preferred display. 

Calibrating your screen

I’ve done this before using Windows Media Centre, nand now you can calibrate your screen by running Display Colour Calibration Wizard, Click Start, type DCCW and press Enter to give it a try.

 

Richt-Click

If you’ve not already tried this Right-Click has come it to it’s own with so many features available, and making it so much faster to perform your day to day actions

 

Custom power switch

By default, Windows 7 displays a plain text ‘Shut down’ button on the Start menu, but it only takes a moment to change this action to something else. If you reboot your PC a few times every day then that might make more sense as a default action: right-click the Start orb, select Properties and set the ‘Power boot action’ to ‘Restart’ to make it happen.

 

Give the menu bar a shake

If you shake the menu bar all the other windows minimize, how cool is that?

If you have multiple windows open on your desktop and things are getting too cluttered, it used to be a time-consuming process to close them all down. In Windows 7 you can use the Aero Shake feature to minimise everything in seconds, using a cool mouse gesture. Grab the title bar of the window you wish to keep open and give it a shake, and rejoice in a clear desktop area.

 

Use Sticky Notes

The Sticky Notes app is both simpler and more useful in Windows 7. Launch StikyNot.exe and you can type notes at the keyboard; right-click a note to change its colour; click the + sign on the note title bar to add another note; and click a note and press Alt + 4 to close the note windows.

 

RSS-powered Windows 7 desktop slideshowsRSS-powered Windows 7 desktop slideshows

Now have the power to change your desktop via RSS feeds, click here to see how to do it

 

Keyboard shortcuts

Windows 7 supports several useful new keyboard shortcuts.

Alt+P

Display/ hide the Explorer preview pane

Windows Logo+G

Display gadgets in front of other windows

Windows Logo++ (plus key)

Zoom in, where appropriate

Windows Logo+- (minus key)

Zoom out, where appropriate

Windows Logo+Up 

Maximise the current window

Windows Logo+Down

Minimise the current window

Windows Logo+Left

Snap to the left hand side of the screen

Windows Logo+Right

Snap to the right hand side of the screen

Windows Logo+Home

Minimise/ restore everything except the current window

 

Multi-threaded Robocopies

An excellent command-line robocopy tool with new switches introduced with Windows 7. Check out, /MT, can improve speed by carrying out multi-threaded copies with the number of threads you specify. Enter robocopy /? at a command line for the full details.