Pages

Tuesday, March 29, 2011

Using SQL Server Authentication on SQL Express

For most of my databases, I am content to use Windows Authentication for my database access.  In a development or small shop environment, it's usually acceptable to let Windows bear the burden of authentication.
But if you need to add just one database app that requires a separate login beyond the Windows login, here's how.

First a few definitions.
SERVER vs. DATABASE
SQL Server (in my case express 2008 R2)  is not a Database.  In the management studio, when you log into the management studio, you can see that .\SQLEXPRESS (the root node) is called a server.  It is important to read this article carefully when I talk about servers vs. databases, as it makes a difference.

LOGIN vs. USER
This is a little more blurry, but a login is not much more than a name, password, and a set of permissions to access the server.  A user exists in databases, and has specific roles and permissions in an individual database.

Getting Started
In the Mode
First, make sure your server is in the mode (mood?) to use both kinds of authentication.
Open SQL Server Management Studio and right-click the SERVER name.  Pick properties.
Then on the Security tab, make sure SQL Server and Windows Authentication mode is selected.
If it wasn't, then you'll need to save the change and restart SQL Server.  If it was already selected you can skip this section.
Restarting SQL Server
Return to the SQL Server Management Studio and right click the Server Name.
Select restart.

Create a Server Login
When we create logins, in general we want to create one login per user. First, log into management studio using windows authentication (or however you normally gain admin access).  Under the server tree (not a database tree) select Security- Logins and pick New Login.


Add your login... 
Make sure to add a password and select the default database.
 
On the User Mapping tab...
Select the checkbox by your database.
Enter dbo as the default schema
Check every permission that doesn't contain the word deny.
Note that there are some additional roles in my database that I had added previously.
 On the Status tab, make sure grant and enabled are selected.
Click OK.
Using witch-hazel and fairy dust, Management studio will now create your LOGIN to the SERVER, and your USER in the DATABASE.

Look in the Databases tree and find the user created by the wizard.
Open his properties.
The General tab should look much like this.

Testing
To test your new user/login, open a second copy of SQL Server Management Studio.
Change to SQL Server Authentication and enter your user login info.
If you forgot the password (as I did about 6 times while writing this article) you can go back to the login tree in your first SQL Server Management Studio window and change it there, then try again.

Now it's easy to use this login in your programs to access this database.  It's also easy to set database level permissions, roles etc.

in C# to create a connection string to access the database do this:





Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Friday, March 4, 2011

Using Web Safe Fonts in CSS


If you are editing the stylesheet in Visual Web Developer, and you access the font-family dropdown, Microsoft shows 3 common web-safe fonts and then every font in your system. 

This is dumb.  Most of us designers have many, many fonts that the average web browsing public has never heard of. 

Therefore, I present this list of Web Safe Fonts.  Use this list in the font-family  settings to achieve the effect you want, with maximum web compatibility.


Web Safe Fonts Preview


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Arial, Helvetica, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Arial Black', Gadget, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz


0123456789

font-family: 'Bookman Old Style', serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Comic Sans MS', cursive;


The quick brown fox jumps over the lazy dog.


ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Courier, monospace;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789


font-family: 'Courier New', Courier, monospace;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Garamond, serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ


abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Georgia, serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Impact, Charcoal, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Lucida Console', Monaco, monospace;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz


0123456789

font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'MS Sans Serif', Geneva, sans-serif;


The quick brown fox jumps over the lazy dog.


ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'MS Serif', 'New York', sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789


font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Symbol, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ


abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Tahoma, Geneva, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Times New Roman', Times, serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Trebuchet MS', Helvetica, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz


0123456789

font-family: Verdana, Geneva, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Webdings, sans-serif;


The quick brown fox jumps over the lazy dog.


ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Wingdings, 'Zapf Dingbats', sans-serif;






Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Thursday, March 3, 2011

SQL Server 2008 R2 Express

Three Hours later...
What a bunch of USELESS CRAP!

For those who lack a life, the text in the box below is...

The following notes apply to this release of SQL Server only.

Microsoft Update

For information about how to use Microsoft Update to identify updates for SQL Server 2008 R2, see the Microsoft Update Web site at http://go.microsoft.com/fwlink/?LinkId=108409.

Samples

By default, sample databases and sample code are not installed as part of SQL Server Setup. To install sample databases and sample code for non-Express editions of SQL Server 2008 R2, see the CodePlex Web site at http://go.microsoft.com/fwlink/?LinkId=87843. To read about support for SQL Server sample databases and sample code for SQL Server Express, see Databases and Samples Overview on the CodePlex Web site at http://go.microsoft.com/fwlink/?LinkId=110391.

Release Notes

For more information about late-breaking changes in this release of SQL Server, see the latest readme file at http://go.microsoft.com/fwlink/?LinkId=141691.

Documentation and Links

To install the .NET Framework SDK, see “Installing the .NET Framework SDK” in SQL Server 2008 R2 Books Online at http://go.microsoft.com/fwlink/?LinkId=141693.

For information about SQL Server 2008 R2 Surface Area Configuration, see the following SQL Server 2008 R2 documentation topics:

In SQL Server 2008 R2 Books Online: “Understanding Surface Area Configuration.”

In SQL Server 2008 R2 Setup Help: “Minimize SQL Server 2008 R2 Surface Area.”

In SQL Server 2008 R2 Books Online on MSDN: Understanding Surface Area Configuration at http://go.microsoft.com/fwlink/?LinkId=141692.
And the log file it left says

Overall summary:
  Final result:                  Failed: see details below
  Exit code (Decimal):           -2068052398
  Exit facility code:            1212
  Exit error code:               1618
  Exit message:                  Failed: see details below
  Start time:                    2011-03-03 15:55:52
  End time:                      2011-03-03 16:52:14
  Requested action:              Upgrade
  Log with failure:              C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20110303_155335\sql_engine_core_inst_ctp6_Cpu32_1.log
  Exception help link:           http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.50.1600.1

Machine Properties:
  Machine name:                  WEB1
  Machine processor count:       2
  OS version:                    Windows Server 2003
  OS service pack:               Service Pack 2
  OS region:                     United States
  OS language:                   English (United States)
  OS architecture:               x86
  Process architecture:          32 Bit
  OS clustered:                  No

Product features discovered:
  Product              Instance             Instance ID                    Feature                                  Language             Edition              Version         Clustered
  Sql Server 2008      SQLEXPRESS           MSSQL10.SQLEXPRESS             Database Engine Services                 1033                 Express Edition      10.1.2531.0     No       
  Sql Server 2008      SQLEXPRESS           MSSQL10.SQLEXPRESS             SQL Server Replication                   1033                 Express Edition      10.1.2531.0     No       
  Sql Server 2008                                                          Management Tools - Basic                 1033                 Express Edition      10.0.1600.22    No       

Package properties:
  Description:                   SQL Server Database Services 2008 R2
  ProductName:                   SQL Server 2008 R2
  Type:                          RTM
  Version:                       10
  SPLevel:                       0
  Installation location:         d:\bf7ec28684b1818f6c3151c67288a7c8\x86\setup\
  Installation edition:          EXPRESS_ADVANCED

User Input Settings:
  ACTION:                        Upgrade
  AGTDOMAINGROUP:                <empty>
  BROWSERSVCSTARTUPTYPE:         Automatic
  CONFIGURATIONFILE:            
  CUSOURCE:                     
  ENU:                           True
  ERRORREPORTING:                False
  FAILOVERCLUSTERROLLOWNERSHIP:  2
  FARMACCOUNT:                   <empty>
  FARMADMINPORT:                 0
  FARMPASSWORD:                  *****
  FTSVCACCOUNT:                  <empty>
  FTSVCPASSWORD:                 *****
  FTUPGRADEOPTION:               Import
  HELP:                          False
  IACCEPTSQLSERVERLICENSETERMS:  False
  INDICATEPROGRESS:              False
  INSTANCEID:                    SQLEXPRESS
  INSTANCENAME:                  SQLEXPRESS
  ISSVCACCOUNT:                  NT AUTHORITY\NetworkService
  ISSVCPASSWORD:                 *****
  ISSVCSTARTUPTYPE:              Automatic
  PASSPHRASE:                    *****
  PCUSOURCE:                    
  PID:                           *****
  QUIET:                         False
  QUIETSIMPLE:                   False
  RSCATALOGSERVERINSTANCENAME:   Unknown
  RSUPGRADEDATABASEACCOUNT:     
  RSUPGRADEPASSWORD:             *****
  SQLDOMAINGROUP:                <empty>
  SQMREPORTING:                  True
  UIMODE:                        AutoAdvance
  X86:                           False

  Configuration file:            C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20110303_155335\ConfigurationFile.ini

Detailed results:
  Feature:                       Database Engine Services
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Client Connectivity
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Client Connectivity SDK
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Writer
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Browser
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Server Replication
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Compact Edition Runtime
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       Management Tools - Basic
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

Rules with failures:

Global rules:

Scenario specific rules:

Rules report file:               C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20110303_155335\SystemConfigurationCheck_Report.htm





Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, February 22, 2011

SQL Server Money Type Conversion

How to convert a SQL Server money Type to a C# floating point number.
The easiest way yo do this is to use the C# decimal type.

decimal amount = (decimal)myReader["Amount"];

I had tried double and float, and they both gave me an explicit conversion error.

FYI: when initializing a decimal, use this:

decimal mynumber=0m;

Think of the "m" as "money".

In format strings, use {0:C} (currency format) to display.

string.format("{0:C}",amount);


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, January 25, 2011

Junk Posts

I have a page on my site that allows interested parties to post questions to my business.  Recently it's been flooded with these junk posts.  I'm not sure what the payload is, because my e-mailer strips out all the HTML and JavaScript before messaging me.  There is one aspect of this that I find somewhat disturbing though.


All the posts are similar, but they come from IP addresses all over the world.  Here are the latest ones:

IP addressevent occuredCountry
125.7.106.362011-01-25 03:15:01.097AUSTRALIA
194.71.15.2422011-01-25 00:15:28.947SWEDEN
58.1.236.522011-01-24 23:48:23.503JAPAN
62.189.102.2292011-01-24 22:36:23.813UNITED KINGDOM
84.170.167.12011-01-24 22:16:55.657
174.133.230.402011-01-24 21:20:31.047UNITED STATES
71.101.103.2472011-01-24 19:31:49.997UNITED STATES
186.88.170.2232011-01-24 14:23:03.003VENEZUELA
216.185.76.742011-01-24 08:58:20.940CANADA
193.137.203.2312011-01-24 06:30:30.783PORTUGAL
74.121.148.32011-01-24 05:55:59.257UNITED STATES
219.234.246.2482011-01-24 03:32:39.443CHINA
68.238.66.1132010-12-09 23:07:47.327UNITED STATES
202.108.50.702010-12-09 09:54:13.323CHINA
190.177.66.1852010-12-09 05:13:55.220ARGENTINA
212.178.200.722010-12-09 05:09:22.023NETHERLANDS
200.55.16.502010-12-09 05:04:51.767ARGENTINA
187.9.58.1942010-12-09 01:14:22.237BRAZIL
212.71.32.942010-12-09 01:06:39.560SAUDI ARABIA
193.56.241.1252010-12-08 23:53:00.620FRANCE
85.255.197.1252010-12-08 21:19:54.407
79.125.121.1212010-12-08 17:09:40.170IRELAND


The thing would not be alarming but the emails (with the java and HTML removed) are all nearly identical. They all look something like this:

Dx6CQw ccvpfvghxsko, [url=http://qdzwgbbwegwf.com/]qdzwgbbwegwf[/url], [link=http://zadpuhxlkcme.com/]zadpuhxlkcme[/link], http://yvetloauhztz.com/


Don't worry, I tried looking for these domains and they are all unregistered. The real payload of the post must have been in the HTML/JavaScript. It is my hope in posting these that some of you googling upon this page might see this and have some insight as to what the point might be. If so, please comment below.





Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Friday, January 21, 2011

Snobs

I am a snob.

I had to reinstall Visual Web Developer after a crash.  I edited a few old web sites, and apart from it squawking at me about my .NET 3.5 sites not being upgraded, all was well. Ok, so I decided to take a peek at my own web site and perhaps give it a fresh coat of paint. 

So I created a new project.  I had some great ideas about the menu bar.  3 hours of tormented editing later, it looked just like I wanted.  But I wanted the 'current' web page to be displayed in the "selected" style, so I thought I'd open the code window and see if I couldn't make some magic.

Until...

ACK!  My whole freaking project is in VISUAL BASIC! 

You see, in the 1980's I programmed in GWBASIC.  I was young and had no idea what a programming language could be.  I moved on to Atari Basic.  Then I was working a project on those evil IBM PCs and a friend handed me a Borland Turbo Pascal 2.0 disk. 

My God it was great!  Fast compiler, fast, efficient code - it rocked my world.  And just like that I began looking down on people still using that outdated, slow, interpreted BASIC.

Turbo Pascal led to Paradox, Paradox led to Delphi, and after that, C# and ASP.NET.  Each time I moved up a rung, I looked down on those stuck on the level below me.  But I also encountered others.  People who looked at me and said, "you should switch to MAC" or "you should switch to Linux".  I scoffed and called them snobs.  Apple Snobs and Linux Snobs.  Even within the *nix world, there are POSIX snobs, and UNIX purists, and Red Hat, and Fedora.  Let's not even talk about BEOS/HAIKU

Finally - years ago - I realized that all these languages and OSes have their own place, and even though I like to complain bitterly about Redmond, I have to admit that Microsoft products help me get the job done.

Set the TARDIS for this week.  That web site, and my three hours of work - polluted with VISUAL BASIC of all things.  All my C# snobbery and VB disdain kicked back into high gear.  Not that it's a driving campaign in my life, but it's still there.  Even worse than my VB-infested web site, I am a snob!




Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, September 28, 2010

I do not have the frakking time for this!

Server Application Error

The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact the server administrator for assistance.
An asp.net site that has been RUNNING and STABLE for 5 years suddenly REFUSES to execute any ASP classic pages!  I have done NOT ONE GDAMNED THING to the server other than install a MICROSOFT SECURITY UPDATE, which of course happens automatically.

So far, I have lost a FULL DAY OF PRODUCTIVITY over this, and it is NOT resolved at ALL.

in my event log I get these 3 every time I try to hit any asp classic page...

Event Type:    Error
Event Source:    Userenv
Event Category:    None
Event ID:    1058
Date:        9/28/2010
Time:        2:03:46 PM
User:        NT AUTHORITY\SYSTEM
Computer:    WEB1
Description:
Windows cannot access the file gpt.ini for GPO CN={31B2F340-016D-11D2-945F-00C04FB984F9},CN=Policies,CN=System,DC=209softwarecom,DC=local. The file must be present at the location <\\209softwarecom.local\sysvol\209softwarecom.local\Policies\{31B2F340-016D-11D2-945F-00C04FB984F9}\gpt.ini>. (Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator. ). Group Policy processing aborted.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Event Type:    Error
Event Source:    Userenv
Event Category:    None
Event ID:    1030
Date:        9/28/2010
Time:        2:03:46 PM
User:        NT AUTHORITY\SYSTEM
Computer:    WEB1
Description:
Windows cannot query for the list of Group Policy objects. Check the event log for possible messages previously logged by the policy engine that describes the reason for this.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Event Type:    Warning
Event Source:    W3SVC-WP
Event Category:    None
Event ID:    2236
Date:        9/28/2010
Time:        2:08:01 PM
User:        N/A
Computer:    WEB1
Description:
The server failed to load application '/LM/W3SVC/1550346855/Root/cgi-bin'.  The error was 'The server process could not be started because the configured identity is incorrect.  Check the username and password.
'.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
I am past annoyed and fast approaching POSTAL over this.

SUCCESS
Not sure how this happened, but...

I changed the setting to "low" and all is well.



Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Sunday, September 12, 2010

VWD 2010: What's Not to Like?

The primary thing I don't like about Visual Web Developer 2010 is...










Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, September 7, 2010

Easy XML Dataset Tutorial in Visual C# Express

Create the Data Definition
First, create a new application.
 Add a dataset
Right-click in the stripes and add a datatable.
Right click the datatable to add all the columns you want.
Use the Properties form to set column properties.
Repeat until your table is complete.

Continue this until your dataset is complete.  You can add as may tables as you like.  Keep in mind that you are not creating a database (as you would in SQL Server), you're creating a data definition or schema.

Ok, now to use the dataset in your program.
Set up for Editing
From the top menu, select data - show data sources.
Now, just drag a table from the list to your form.
Notice that a number of components are added to your form when you do this...

Now it's time to hook up the UI to a dataset.  First, enable the save icon in the toolbar.

Next, construct the file/save routine.



Now it's time to tell the dataset how to load the data on startup.  Select the dataset and add an Initialized handler.
The trick here is to make sure the xml file exists before loading it.








Now run the program, and enter data.
 Click the SAVE icon, and exit the program.  Then launch it again to verify that the data has been saved.  Simple, eh?
But, where is my XML file?
Since you ran the application in debug mode, your xml data file was created in that directory.  From the C# IDE menu, select File - Open File... and select bin, then debug.  Your xml file is there, and should look a lot like this:

If you want to know more, like how to read/write data to this kind of dataset in code - just leave me a comment!


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Monday, August 23, 2010

ASP.NET User Profiles.

It totally sucks.
Membership data in the ASP.NET database stores user names, emails, and a little other information, but I need to add more... All I want is a few additional columns added to the user's data, like their real name, phone/fax/cell numbers, etc. I don't want to go to the trouble of creating a SQL Server table and managing all the relationships to do this and then creating the SQL to fish that all up in my code.
Well, as it turns out that's exactly what the ProfileCommon object does.
There are a number of uncommonly pleasant surprises when you dig into this feature, so let's get started!
This article assumes you're using an aspnet default database setup created as in this article.
Ok try this: In your code pages, type Profile.: you will see a hint showing the options available.
Profile Context Help
yes you can stretch the pop-up box!
Now, open your web.config file. Look for the end of the system.web section. Insert the following lines.
<profile defaultProvider="ProfileProvider">
            <providers>
                <clear/>
                <add connectionStringName="ConnectionString" applicationName="/" name="ProfileProvider" type="System.Web.Profile.SqlProfileProvider"/>
            </providers>
            <properties>
                <add name="email_verified" allowAnonymous="false" type="System.Boolean"/>
                <add name="subscribed" allowAnonymous="false" type="System.Boolean"/>
                <add name="MemberID" allowAnonymous="false" type="System.String"/>
                <add name="FullName" allowAnonymous="false" type="System.String"/>
            </properties>
        </profile>
OK, obviously your connection string has to be changed to match the one in your Membership and Roles provider. Look at the profile section. The editor doesn't help much with creating these types, but they are not hard to figure out.
All you need to do is create whatever columns you want to add. Then once they are added here, go back to your C# code and type Profile. again.

Notice that the added properties are now available to you to use in your programming. You can display then onscreen, let people edit them, even modify them in your code.


The Profile object is of type ProfileCommon, and is automatically instantiated when your page is loaded. Here are a few shortcuts for using it.


Use the logged-in user's Profile Profile.[fieldname]
Look up another user's Profile ProfileCommon otherProfile = Profile.GetProfile(otherUSerName);

Tuesday, August 10, 2010

Server Application Unavailable

I fought this for a week - there was so much junk info out there.  My system config is as follows:
  • Windows SBS 2003 SP2 
  • IIS 6
  • Hosting a mix of ASP.NET 2.0, 2.5, 3.5 sites
When I added my first Visual Web Developer 2010 site using the .net 4.0 framework, These errors happened.

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request.
Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.
...and in the Application event Log...


Event Type:    Error
Event Source:    ASP.NET 4.0.30319.0
Event Category:    None
Event ID:    1007
Date:        8/4/2010
Time:        3:34:08 PM
User:        N/A
Computer:    WEB1
Description:
aspnet_wp.exe could not be launched because the username and/or password supplied in the processModel section of the config file are invalid.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

OMG this was so easy.
On the Web Server...
  1. open the C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config folder. 
  2. Edit Machine.config.
  3. in the  <system.web></system.web> section, change <processModel autoConfig="true"> to <processModel username="SYSTEM"></processModel>
  4. Save and exit.
  5. open a command window and enter IISRESET.
  6. Your web site should now work.

Tuesday, August 3, 2010

HTML Dropdown for all US and Canada States/Provinces

<SELECT NAME="state" SIZE=1>
                <OPTION VALUE="United States" disabled="disabled">United States</option>
                <OPTION VALUE="AL - Alabama">Alabama</option>
                <OPTION VALUE="AK - Alaska">Alaska</option>
                <OPTION VALUE="AZ - Arizona">Arizona</option>
                <OPTION VALUE="AR - Arkansas">Arkansas</option>
                <OPTION VALUE="CA - California" SELECTED>California</option>
                <OPTION VALUE="CO - Colorado">Colorado</option>
                <OPTION VALUE="CT - Connecticut">Connecticut</option>
                <OPTION VALUE="DE - Delaware">Delaware</option>
                <OPTION VALUE="DC - Dist of Columbia">District of Columbia</option>
                <OPTION VALUE="FL - Florida">Florida</option>
                <OPTION VALUE="GA - Georgia ">Georgia</option>
                <OPTION VALUE="HI - Hawaii">Hawaii</option>
                <OPTION VALUE="ID - Idaho">Idaho</option>
                <OPTION VALUE="IL - Illinois">Illinois</option>
                <OPTION VALUE="IN - Indiana">Indiana</option>
                <OPTION VALUE="IA - Iowa">Iowa</option>
                <OPTION VALUE="KS - Kansas">Kansas</option>
                <OPTION VALUE="KY - Kentucky">Kentucky</option>
                <OPTION VALUE="LA - Louisiana">Louisiana</option>
                <OPTION VALUE="ME - Maine">Maine</option>
                <OPTION VALUE="MD - Maryland">Maryland</option>
                <OPTION VALUE="MA - Massachusetts">Massachusetts</option>
                <OPTION VALUE="MI - Michigan">Michigan</option>
                <OPTION VALUE="MN - Minnesota">Minnesota</option>
                <OPTION VALUE="MS - Mississippi">Mississippi</option>
                <OPTION VALUE="MO - Missouri">Missouri</option>
                <OPTION VALUE="MT - Montana">Montana</option>
                <OPTION VALUE="NE - Nebraska">Nebraska</option>
                <OPTION VALUE="NV - Nevada">Nevada</option>
                <OPTION VALUE="NH - New Hampshire">New Hampshire</option>
                <OPTION VALUE="NJ - New Jersey">New Jersey</option>
                <OPTION VALUE="NM - New Mexico">New Mexico</option>
                <OPTION VALUE="NY - New York">New York</option>
                <OPTION VALUE="NC - North Carolina">North Carolina</option>
                <OPTION VALUE="ND - North Dakota">North Dakota</option>
                <OPTION VALUE="OH - Ohio">Ohio</option>
                <OPTION VALUE="OK - Oklahoma">Oklahoma</option>
                <OPTION VALUE="OR - Oregon">Oregon</option>
                <OPTION VALUE="PA - Pennsylvania">Pennsylvania</option>
                <OPTION VALUE="RI - Rhode Island">Rhode Island</option>
                <OPTION VALUE="SC - South Carolina">South Carolina</option>
                <OPTION VALUE="SD - South Dakota">South Dakota</option>
                <OPTION VALUE="TN - Tennessee">Tennessee</option>
                <OPTION VALUE="TX - Texas">Texas</option>
                <OPTION VALUE="UT - Utah">Utah</option>
                <OPTION VALUE="VT - Vermont">Vermont</option>
                <OPTION VALUE="VA - Virginia">Virginia</option>
                <OPTION VALUE="WA - Washington">Washington</option>
                <OPTION VALUE="WV - West Virginia">West Virginia</option>
                <OPTION VALUE="WI - Wisconsin">Wisconsin</option>
                <OPTION VALUE="WY - Wyoming">Wyoming</option>
                <OPTION VALUE="GU - Guam">GUAM</option>
                <OPTION VALUE="PR - Puerto Rico">Puerto Rico</option>
                <OPTION VALUE="VI - Virgin Islands">Virgin Islands</option>

                <OPTION VALUE="Canada" disabled="disabled">Canada</option>
                <OPTION VALUE="AB - Alberta">Alberta</option>
                <OPTION VALUE="BC - British Columbia">British Columbia</option>
                <OPTION VALUE="MB - Manitoba">Manitoba</option>
                <OPTION VALUE="NB - New Brunswick">New Brunswick</option>
                <OPTION VALUE="NL - Newfoundland and Labrador">Newfoundland and Labrador</option>
                <OPTION VALUE="NT - Northwest Territories">Northwest Territories</option>
                <OPTION VALUE="NS - Nova Scotia">Nova Scotia</option>
                <OPTION VALUE="NU - Nunavut">Nunavut</option>
                <OPTION VALUE="ON - Ontario">Ontario</option>
                <OPTION VALUE="PE - Prince Edward Island">Prince Edward Island</option>
                <OPTION VALUE="QC - Quebec">Quebec</option>
                <OPTION VALUE="SK - Saskatchewan">Saskatchewan</option>
                <OPTION VALUE="YT - Yukon">Yukon</option>
              </SELECT>

Saturday, July 17, 2010

Visual Web Developer: Productivity Killer

Oh, my god this is awful!

I noticed a couple quick changes I needed to make to my website.  So I popped open VWD.  It took 4 minutes to load.  4 MINUTES!  I was screaming!  Then I selected the website project and another 3 minutes go by!  I started this blog entry to vent so I don't get a brain aneurysm!

Guess what!

10 minutes after I noticed the error, and spent this whole time screaming at my computer... I can't remember what the hell was wrong with my site anymore! 

I think I need to drink heavily now.

Share This!

Contact Us

Name

Email *

Message *