Custom SiteUrls Provider - Constructor on type not found error?

rated by 0 users
Not Answered This post has 0 verified answers | 8 Replies | 3 Followers

Marc Mezzacca
Top 200 Contributor
115 Posts
Points 1,725
By: Marc Mezzacca
Posted: Thu, May 29 2008 6:12 PM

I'm trying to create a custom SiteUrls provider, but am having no luck.  I keep getting the error:

Constructor on type 'SPUrls.SiteUrlsProvider' not found.

1) I Created a Class in a seperate project.

namespace SPUrls
{
    class SiteUrlsProvider : SiteUrls
    {
        private CommunityServer.Urls.UrlsData urlData = null;
        private ArrayList _links;
        public SiteUrlsProvider(CommunityServer.Urls.UrlsData data, ArrayList links) : base(data, links)
        {
            urlData = data;
            _links = links;
        }

        //Overrides go here

    }

}

2) I Compiled, added .dll to bin and added this to communityserver.config

        <add
            name = "SiteUrlsProvider"
            type = "SPUrls.SiteUrlsProvider, SPUrls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
          />

Any ideas?

Next Generation Shopping

 

All Replies

Alex Crome
Top 10 Contributor
2,779 Posts
Points 41,070
TelligentSupportTeam
By: Alex Crome
Posted: Thu, May 29 2008 7:07 PM In reply to

Have you tried making your SiteUrlsProvider a public class?

namespace SPUrls
{
    public class SiteUrlsProvider : SiteUrls
    {
        private CommunityServer.Urls.UrlsData urlData = null;
        private ArrayList _links;
        public SiteUrlsProvider(CommunityServer.Urls.UrlsData data, ArrayList links) : base(data, links)
        {
            urlData = data;
            _links = links;
        }

        //Overrides go here

    }

}

 
  • Post Points: 20 |
Marc Mezzacca
Top 200 Contributor
115 Posts
Points 1,725
By: Marc Mezzacca
Posted: Thu, May 29 2008 7:15 PM In reply to

Yeah, I took it out after viewing Wyatts sample post here - I'll put it back and recompile, see if it makes a difference.

 

Next Generation Shopping

 
  • Post Points: 5 |
Marc Mezzacca
Top 200 Contributor
115 Posts
Points 1,725
By: Marc Mezzacca
Posted: Thu, May 29 2008 7:18 PM In reply to

...Oh well still no luck, any other ideas?  Do I have to take out the SiteUrlsDataProvider node from the communityserver.config?

 

Next Generation Shopping

 
  • Post Points: 5 |
Marc Mezzacca
Top 200 Contributor
115 Posts
Points 1,725
By: Marc Mezzacca
Posted: Mon, Jun 9 2008 8:39 PM In reply to

Ben or Wyatt any input on this?

 

Next Generation Shopping

 
  • Post Points: 20 |
MattImholt
Not Ranked
5 Posts
Points 85
By: MattImholt
Posted: Thu, Jul 3 2008 6:36 PM In reply to

I know this is a really old thread, but I struggled with this same problem all day today before I figured it out.  The postings on the site are a bit outdated . . . for CS2008, if you want to override SiteUrls to create a custom provider, you're class has to look like:

public class CustomSiteUrlsProvider : CommunityServer.Components.SiteUrls

{

 

public CustomSiteUrlsProvider(object data) : base((CommunityServer.Urls.UrlsData)data, null) { }

}

Watch the constructor . . .it's not at all what you'd think it would be (if you simply inherit from SiteUrls).  I'm thinking that you might want to update the line of code in SiteUrls.Instance() so that the signatures on SiteUrls and a custom siteUrlsProvider match. 

-Matt

 

 
  • Post Points: 20 |
Marc Mezzacca
Top 200 Contributor
115 Posts
Points 1,725
By: Marc Mezzacca
Posted: Wed, Jul 23 2008 4:47 PM In reply to

Matt,

I tried the code you provided.  Still no luck.

I still get the error: Constructor on type 'CustomSiteUrlsProvider' not found.

I'm thinking that you might want to update the line of code in SiteUrls.Instance() so that the signatures on SiteUrls and a custom siteUrlsProvider match.

Can you explain what you mean by this?

Next Generation Shopping

 
MattImholt
Not Ranked
5 Posts
Points 85
By: MattImholt
Posted: Sun, Jul 27 2008 9:02 AM In reply to

Sorry, the "you" in that sentence is more than a little vauge.  I meant that the CS development team might want to make the signatures match.

Here's a class that I have working in production.  Sorry about the formating.

public class CustomSiteUrlsProvider : CommunityServer.Components.SiteUrls

{

public CustomSiteUrlsProvider(object data) : base((CommunityServer.Urls.UrlsData)data, null) { }

 public override string UserProfile(int userID)

{

CommunityServer.Components.

User Usr;

Usr = CommunityServer.

 

 

Users.GetUser(userID, false);  

return "http://" + Usr.Username + ".PrivateURL.com";

 }

 

public override string UserProfile(string username)

{

 

return "http://" + username + ".PrivateUrl.com";

}

 

 
  • Post Points: 20 |
Marc Mezzacca
Top 200 Contributor
115 Posts
Points 1,725
By: Marc Mezzacca
Posted: Sun, Jul 27 2008 2:51 PM In reply to

I figured you may have meant the CS team.

Hmm, I'll try it again.  What syntax do you have for this in the CommunityServer.config?

Next Generation Shopping

 
  • Post Points: 5 |
Page 1 of 1 (9 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com