Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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 March 22nd, 2006, 04:59 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Why docodeSubDirectories cause ProfileCommon error

Working on Chapter 11 - the part about implementing a custom profile to allow the user to select themes.

I've stripped everything out of the profile except the themes attribute.

    <profile enabled="true">
      <properties>
         <add name="Theme"/>
      </properties>
    </profile>

I should mention that I'm a newbie and have implemented MS Access providers - based on a lot of stuff I've pulled off MSDN2. - That said, they work - membership, roles, and now profiles.

However, I do have a weird issue - when I put in the section about the HttpModules >

    <httpModules>
      <add name="Page" type="Wrox.Web.GlobalEvents.ThemeModule" />
    </httpModules>

and added the theme.vb module to the App_Code directory, I started getting the following error. . .

Error 4 Type 'ProfileCommon' is not defined. c:\inetpub\wwwroot\Basic_Provider\App_Code\VB\Them eModule.vb 33 26 http://localhost/Basic_Provider/

(BTW, I like the VS2005 copy error codes feature - I would have liked it better if I could have just selected any of the relevant text by clicking and dragging though)

I did lots of research on the web and tried all the fixes I could find - stopping and starting the webserver, killing the aspnet process, making a change to the web.config file, saving, loading a page, changing config back, saving, new method (instead of directcast - CType(ProfileBase.Create("ProfileTestVB", True), ProfileCommon),
essentially everything I could find. Finally, I dumped my config file, started with the Wrox application config file, dumped the parts like the shopping cart, the system.net, etc. that I wasn't using and, the error disappeared. Of course, the app didn't work, so I started adding back all of the stuff that I'd added.

Anyway, it's late, I'm rambling, the part of the config file that caused the error to occur was the compilation section. Based on another Wrox book - Professional ASP.Net2 (pg 79-80) and all the rah-rah about how language independent .NET 2 was, I added the following section to my web.config file:

      <compilation debug="true" explicit="true">
          <codeSubDirectories>
              <add directoryName="VB"/>
              <add directoryName ="CS"/>
          </codeSubDirectories>
      </compilation>

My question is, what gives? I did this because I'm not great in C# and there were some membership pages that were written in C# that I wanted to incorporate in the site. I was going to re-work them because they were ugly, but the basic functionality was there. I thought I’d cut short the development time. They worked fine beside my vb providers until I added your ThemeModule.vb. How come everything broke down?

Thanks for your time,

Joe.


  #2 (permalink)  
Old March 22nd, 2006, 11:06 PM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Follow up:

Just to test, I decided to add back the subdirectories and just moved the theme.vb module into the main app_code directory. Re-built and no errors. It made no difference if I moved the rest of the VB providers I'm using either into the "VB" directory or outside of it.

OleDbAccessRoleProvider.vb
OleDbAccessProfileProvider.vb
OleDbAccessMembershipProvider.vb

For instance, the file structure could be:
App_code
  ThemeModule.vb
    CS <dir>
        List of class files
    VB <dir>
        OleDbAccessRoleProvider.vb
        OleDbAccessProfileProvider.vb
        OleDbAccessMembershipProvider.vb

or

App_code
  ThemeModule.vb
  OleDbAccessRoleProvider.vb
  OleDbAccessProfileProvider.vb
  OleDbAccessMembershipProvider.vb
    CS <dir>
        List of class files
    VB <dir>

It's just odd. It's seems as if as long as the compiler doesn't have to deal with mixed source files in App_Code, it's happy - it doesn't care how you manage them, provided you do. The subdirectories aren't sole locations where files of a particular language can appear, just additional locations where they can be stored separate from any other language files. I guess you could use the subdirectories to store class files relating to a particular part of your web application if you had multiple files to store

ProvidersDir <dir>
        OleDbAccessRoleProvider.vb
        OleDbAccessProfileProvider.vb
        OleDbAccessMembershipProvider.vb
BusinessLogic < dir>
Etc.

The part I don’t understand is why the code referencing ProfileCommon code

>> Dim pb As ProfileCommon = DirectCast(HttpContext.Current.Profile, ProfileCommon)

must be at the top level of the App_Code directory for this to work.

Joe.

  #3 (permalink)  
Old March 26th, 2006, 06:02 PM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I couldn't get the themes module to work on anonymous users. I tried adding a default value to the database and to the properties setup in the web.config. I finally got it to work by adding this line of code in the module itself:

                Dim pb As ProfileCommon = DirectCast(HttpContext.Current.Profile, ProfileCommon)
             * If pb.Theme = Nothing Then pb.Theme = "BasicAlpha"
                p.Theme = pb.Theme

BasicAlpha was just what I named the default skin I wanted to use in the site.

Was there another way, some setting that I missed that could have handled this?

Thanks,

Joe.

  #4 (permalink)  
Old March 3rd, 2008, 12:15 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2008
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

RIGHT FRUGGING UNBELIEVABLY FRUSTRATING BANG THE FRUGGING DESK DEATH TO MICROSOFT DEVELOPER IDIOTS .. on .. I've been going abso *crazy* trying to get profiles working on various sites we support .. been WEEKS of ripping out hair and cursing the existence of ASP.NET and the moronics who wrote it and continue to blather its saving graces - CRAP. And yes all my code is in neat little sub-folders in App_Code .. WHODA THUNK Microsoft India could be so stupid as to write code that just gracefully ignores - no errors, nothing but dented keyboards and replace lcd monitors.

With all the bugs and limitations in: FormView, GridView, SqlDataSource,ObjectDataSource .. and now another .. App_Code .. I'm really starting to doubt the viability of using ASP.NET for anything other than the most simplistics of situations. .. Would be far better to just go back to hand coding.

bitter n'twisted by ms.
Riix

 


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
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
ShoppingCart is not a member of ProfileCommon sstuber BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 May 21st, 2008 04:55 PM
ProfileCommon not defined error flyer ASP.NET 2.0 Basics 0 September 26th, 2007 08:07 PM
ProfileCommon Compilation Error bleitner ASP.NET 2.0 Professional 1 January 15th, 2006 03:03 PM



All times are GMT -4. The time now is 07:20 AM.


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