Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 12th, 2008, 03:03 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: , , .
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to vantoko
Default convert tbh to Web application project in VS 2008

Hi,

I'm trying to convert my project to a web application project in VS 2008.
So I created my own ProfileCommon class, but this has some problems with my Groups in web.config

<group name="Preferences">
<add name="Theme" type="String" allowAnonymous="true"/>

<add name="Culture" type="String" defaultValue="en-US"/>
<add name="Newsletter" type="mysite.BLL.Newsletters.SubscriptionType"/>

</group>

I get the following error :

string culture = (HttpContext.Current.Profile as ProfileCommon).Preferences.Culture;

Error 102 xxx.ProfileCommon' does not contain a definition for 'Preferences' and no extension method 'Preferences' accepting a first argument of type xxx.ProfileCommon' could be found (are you missing a using directive or an assembly reference?) C:\Users\xxx\Old_App_Code\BasePage.cs 22 74 xxx


which is correct since it's not defined in my class, but that's the issue. how do I define this in my class which now looks like this
public class ProfileCommon : ProfileBase

{

public static ProfileCommon GetUserProfile(string username)
{

return Create(username) as ProfileCommon;
}

public static ProfileCommon GetUserProfile()
{

return Create(Membership.GetUser().UserName) as ProfileCommon;
}

[SettingsAllowAnonymous(false)]public string Description
{

get { return base["FirstName"] as string; }

set { base["FirstName"] = value; }
}

[SettingsAllowAnonymous(false)]public string Location
{

get { return base["LastName"] as string; }

set { base["LastName"] = value; }
}

[SettingsAllowAnonymous(false)]public string FavoriteMovie
{

get { return base["Gender"] as string; }

set { base["Gender"] = value; }
}

}


so the main quesiotn is : how can you best convert to a 2008 web application project. (this way I can use urlrewriter which needs an assemblyname to run the code)

koen


  #2 (permalink)  
Old June 16th, 2008, 11:09 AM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Web application projects, in use since VS 2005 (I think), do not support the ProfileCommon class. There are a couple of free third-party projects that I know of that solve the issue, but AFAIK only one of them works seamlessly with VS 2008: WebProfileBuilder. You can Google that and download it from the msdn code page. Install instructions are provided in the readme.txt file included in the download package, but to sum up:
Quote:
quote:
1. Run the installer.
2. Add this Import statement to your project file. (see special notes below)
    <Import Project="$(MSBuildExtensionsPath)\WebProfileBuilde r\WebProfileBuilder.targets" />
3. Done.
To do step 2 just open the .csproj file (or .vbproj if you use vb projects), search for Import Project, and add the aforementioned statement just below an existing one.
Note that, strictly speaking, ProfileCommon will still be unavailable, but you can replace all functionality by doing this:
Code:
//ProfileCommon profile= this.Profile; // doesn't work on web app projects
 WebProfile profile = new WebProfile(HttpContext.Current.Profile);
Known issues:
In some versions, WebProfileBuilder can't create the required webprofile.cs file; yet, if you create a dummy file by such name (with notepad.exe, for instance) in your project's root folder WebProfileBuilder will overwrite the file's contents.
Hope this helps.
  #3 (permalink)  
Old July 8th, 2008, 11:54 PM
Registered User
 
Join Date: Jul 2008
Location: Sydney, NSW, Australia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did convert TBH to Web application project. All works fine except user control never get excecuted inside CatalogZone and WebPartsTemplate


 <asp:CatalogZone ID="CatalogZone1" runat="server" meta:resourcekey="CatalogZone1Resource1" >
               <ZoneTemplate>
                  <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" runat="server" Title="Site Catalog" meta:resourcekey="DeclarativeCatalogPart1Resource1 ">
                     <WebPartsTemplate>

                            <mb:WelcomeBox ID="WelcomeBox1" runat="server" />
                        <mb:RssReader id="rssReaderGeneric" runat="server" Title="RSS Reader" meta:resourcekey="rssReaderGenericResource1"/>
                        <mb:RssReader id="rssLatestArticles" runat="server" Title="Latest Articles"
                           RssUrl="~/GetArticlesRss.aspx" meta:resourcekey="rssLatestArticlesResource1"
                           MoreText="More articles..." MoreUrl="~/BrowseArticles.aspx" />
                        <mb:RssReader id="rssLatestThreads" runat="server" Title="Latest Threads" meta:resourcekey="rssLatestThreadsResource1"
                           RssUrl="~/GetThreadsRss.aspx?SortExpr=LastPostDate DESC" MoreText="More discussions..." MoreUrl="~/ShowForums.aspx" />
                        <mb:RssReader id="rssMostActiveThreads" runat="server" Title="Most Active Threads" meta:resourcekey="rssMostActiveThreadsResource1"
                           RssUrl="~/GetThreadsRss.aspx?SortExpr=ReplyCount DESC" MoreText="More discussions..." MoreUrl="~/ShowForums.aspx" />
                        <mb:RssReader id="rssLatestProducts" runat="server" Title="Latest Products" meta:resourcekey="rssLatestProductsResource1"
                           RssUrl="~/GetProductsRss.aspx" MoreText="More products..." MoreUrl="~/BrowseProducts.aspx" />
                        <mb:PollBox id="pollGeneric" runat="server" ShowArchiveLink="False" ShowHeader="False" meta:resourcekey="pollGenericResource1" />


                    </WebPartsTemplate>
                 </asp:DeclarativeCatalogPart>
                  <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" Title="Local Page Catalog" meta:resourcekey="PageCatalogPart1Resource1" />
               </ZoneTemplate>
            </asp:CatalogZone>

Does anyone know the reason ?


Thanks,

Quoc

  #4 (permalink)  
Old November 16th, 2008, 07:21 PM
Authorized User
 
Join Date: Aug 2007
Location: Moscow, , Russia.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by vantoko


/// <summary>
        /// Gets or sets the subscription type.
        /// </summary>
        /// <value>The subscription type.</value>
        [SettingsAllowAnonymous(false)]
        public SubscriptionType Newsletter
        {
            get { return (SubscriptionType)base["SubscriptionType"]; }
            set { base["Newsletter"] = value; }
        }



 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TheBeerhouse Project working correctly in VS 2008 asp125 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 October 10th, 2008 12:33 PM
TBH converted from web project to web app. htorres BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 August 25th, 2008 12:44 AM
Convert TBH to Web Application - Webpart issues quoc BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 July 9th, 2008 12:31 AM
Website project vs Web Application Project... thenoseknows ASP.NET 2.0 Professional 0 January 14th, 2007 09:47 PM
can't open asp.net web application project phyzie C# 3 September 26th, 2005 11:40 AM



All times are GMT -4. The time now is 03:34 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.