Hi,
This is my first VS Web application and after the profile properties problems I'm having it might be the last. I now have the Webprofile class solution implemented and all is almost well.
In my web.config I have the following:
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="connDatabase"
applicationName="wineGate"/>
</providers>
<properties>
<add name="FirstName" type="System.String" allowAnonymous="true" />
<add name="LastName" type="System.String" allowAnonymous="true" />
<add name="Cart" type="ShoppingCart" serializeAs="Binary"/>
</properties>
</profile>
<anonymousIdentification
enabled="true"
cookieName=".ASPXANONYMOUS"
cookieTimeout="100000"
cookieSlidingExpiration="true"
cookieProtection="All"
cookieless="AutoDetect"
/>
With the Shopping Cart class as follows (it is just a test class):
<Serializable()> _
Public Class ShoppingCart
Private PID As String
Public Property ProdictID() As String
Get
Return PID
End Get
Set(ByVal value As String)
PID = value
End Set
End Property
End Class
But when I run it I get the following error:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'ShoppingCart' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 17: public class ProfileCommon : System.Web.Profile.ProfileBase {
Line 18:
Line 19: public virtual ShoppingCart Cart {
Line 20: get {
Line 21: return ((ShoppingCart)(this.GetPropertyValue("Cart")));
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\App_Code.qpgjuzi7.0.cs Line: 19
Show Detailed Compiler Output:
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE> "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\1.0.61025.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\assembly\dl3\ada0c2fb\00d31778_bd89c701\SubSonic.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\assembly\dl3\18fbe461\00bff9e2_9f1ec701\AJAXExtensionsToolbox.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\assembly\dl3\ee42ee84\e6836fb9_d6a6c701\wineGate.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\assembly\dl3\bfceb26b\006e4b2b_5f53c601\UrlRewritingNet.UrlRewriter.DLL" /out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\App_Code.qpgjuzi7.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699 "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\App_Code.qpgjuzi7.0.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\App_Code.qpgjuzi7.1.cs"
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42 for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727 Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6081676c\31819704\App_Code.qpgjuzi7.0.cs(19,20): error CS0246: The type or namespace name 'ShoppingCart' could not be found (are you missing a using directive or an assembly reference?)
Show Complete Compilation Source:
Line 1: //------------------------------------------------------------------------------
Line 2: // <auto-generated>
Line 3: // This code was generated by a tool.
Line 4: // Runtime Version:2.0.50727.42
Line 5: //
Line 6: // Changes to this file may cause incorrect behavior and will be lost if
Line 7: // the code is regenerated.
Line 8: // </auto-generated>
Line 9: //------------------------------------------------------------------------------
Line 10:
Line 11: using System;
Line 12: using System.Web;
Line 13: using System.Web.Profile;
Line 14:
Line 15:
Line 16:
Line 17: public class ProfileCommon : System.Web.Profile.ProfileBase {
Line 18:
Line 19: public virtual ShoppingCart Cart {
Line 20: get {
Line 21: return ((ShoppingCart)(this.GetPropertyValue("Cart")));
Line 22: }
Line 23: set {
Line 24: this.SetPropertyValue("Cart", value);
Line 25: }
Line 26: }
Line 27:
Line 28: public virtual string LastName {
Line 29: get {
Line 30: return ((string)(this.GetPropertyValue("LastName")));
Line 31: }
Line 32: set {
Line 33: this.SetPropertyValue("LastName", value);
Line 34: }
Line 35: }
Line 36:
Line 37: public virtual string FirstName {
Line 38: get {
Line 39: return ((string)(this.GetPropertyValue("FirstName")));
Line 40: }
Line 41: set {
Line 42: this.SetPropertyValue("FirstName", value);
Line 43: }
Line 44: }
Line 45:
Line 46: public virtual ProfileCommon GetProfile(string username) {
Line 47: return ((ProfileCommon)(ProfileBase.Create(username)));
Line 48: }
Line 49: }
Line 50:
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
I ma absolutely flumoxed as I can't figure out why it can't find the type or namespace.
Increase your wine sales - www.winecommerce.co.za