MSDN Magazine article on ASP.NET 2.0 WebParts

Onion Blog

Syndication

Ted Pattison and I wrote a piece on the new WebPart infrastructure in ASP.NET 2.0 for September issue of MSDN magazine. It was chosen as the 'preview' piece so you can actually read it online now at http://msdn.microsoft.com/msdnmag/issues/05/09/WebParts/default.aspx - enjoy!

Posted Jul 28 2005, 07:57 AM by fritz-onion
Filed under:

Comments

Christopher Steen - Learning .NET wrote Link Listing - July 28, 2005
on 07-28-2005 8:16 PM
CCNet gets a MSBuild task [Via: Andrew Stopford ]
GhostDoc 1.3.0 Beta 1 Released [Via: Roland Weigelt...
Christopher Steen wrote Link Listing - July 28, 2005
on 07-28-2005 8:18 PM
CCNet gets a MSBuild task [Via: Andrew
Stopford ]
GhostDoc 1.3.0 Beta 1 Released [Via: Roland
Weigelt...
Net wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 08-04-2005 7:33 AM
Hi,

I am trying your application. I have SQL Server 2005 June CTP and no SQL Server 2005 Express. I am getting the folowing error:

Server Error in '/WingtipPortal' Application.
--------------------------------------------------------------------------------

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

SQLExpress database file auto-creation error:
...

How do to correct this?

Thanks in advance,
Fritz Onion wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 08-04-2005 9:49 AM
If you don't have SQL Server 2005 installed, you'll have to tell ASP.NET 2.0 to use your SQL install. To do this, first run the aspnet_regsql.exe to add the necessary tables / sprocs to the db. Then add the following connection string element to your web.config file with the connection string pointing to your database.

<connectionStrings>
<clear/>
<add name="LocalSQLServer" connectionString="Server=.;Database=aspnetdb;trusted_connection=yes"/>
</connectionStrings>

-Fritz
Fritz Onion wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 08-04-2005 9:50 AM
That last comment should have read "If you don't have SQL Server 2005 Express installed, ..."
charles Bretana wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 09-06-2005 1:46 PM
What if you don't want any of the personalization capabilities, but simply want to be able to move around the web parts and store their modoified positions in a database schema of your own design, not in ASP.Net 2.0 Webpart specified schema... (a.k.a. replicating MCMS Template design capabilities using Web parts)... COuld this be done reasonably using this technology??
charles Bretana wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 09-14-2005 8:47 AM
I am writing my own custom ppersonalization provider, and I need to persist and load data into MCMS and in a proprietary SQL schema. Where can I find out how to parse the byte array passed into the provider to extract individual data elements ?
Fritz Onion wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 10-17-2005 5:24 AM
I don't know of any documention of the binary format used for persisting personalization information. All of the work I have seen just deals with the binary data opaquely.
AQ wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 07-10-2006 7:12 PM
Server Error in '/WebSite1' Application.
--------------------------------------------------------------------------------

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

SQLExpress database file auto-creation error:


The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:


If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.


Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +117
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +1093
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +1084
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +272
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +355
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +91
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +115
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +122
System.Data.SqlClient.SqlConnection.Open() +229
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +110

[HttpException (0x80004005): Unable to connect to SQL Server database.]
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +181
System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +167
System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +46
System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +681




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
kapil wrote MSDN Magazine article on ASP.NET 2.0 WebParts
on 08-01-2006 7:43 PM
this is very nice magazine
Adrian Mos wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 10-08-2006 8:01 AM
Regarding the funky SQL Express error:

You have to do one the following:
1. clear any personalization/login/... providers using the clear statement in the web config file, so it will by default use the only one left (your provider)
2. specify a default provider for any configuration area

Same goes for SQL connections
Mike wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 10-16-2007 6:39 AM
Fritz Onion, ur post solved my problem!

thanks,
Mike
Ajay wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 11-02-2007 4:28 PM
I was getting frustrated with the Sql express, thanks for your suggestion,, works great now.

Cheers
A
Steve wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 01-25-2008 5:23 PM
Fritz, this was perfect. Simple and effective.
jyothi wrote re: MSDN Magazine article on ASP.NET 2.0 WebParts
on 02-15-2008 2:10 AM
hi
'm using visualstudio2008. 'm trying to create an application using webparts (asp.net with vb.net)and sqlserverexpress database. First of all i want to know if 'm using default database then i have to change web.config or not.if i have to change then what code i have to mention.pls tell me.
when 'm trying to run the application 'm getting errors like
An error occurred during the execution of the SQL file 'InstallCommon.sql'. The SQL error number is 1802 and the SqlException message is: CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Cannot create file 'C:\DOCUMENTS AND SETTINGS\JKONDA\MY DOCUMENTS\VISUAL STUDIO 2008\WEBSITES\WEBPORTAL\APP_DATA\ASPNETDB_TMP.MDF' because it already exists. Change the file path or the file name, and retry the operation.
Creating the ASPNETDB_99e77ac3f51b4be5907b49ad30850842 database...

Add a Comment

(required)  
(optional)
(required)  
Remember Me?