Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have an branding solution with custom master page. I have also utilities assembly, which is deployed into GAC.

I have a button in my master page and I'd like to bind it's navigate URL to result of static method which is located in utilities assembly. My branding solutions has reference to util assembly. My class looks as follows:

namespace GPE.Utilities.Integration
{
    public static class AuthenticationHelper
    {
        public static string GetSignoutUrl()
        {
            // logic here
        }
    }
}

and my button in master page:

<SharePoint:SPLinkButton runat="server" Text="Signout" NavigateUrl="<%# GPE.Utilities.Integration.AuthenticationHelper.GetSignoutUrl() %>" />

And I'm getting following error:

error CS0234: The type or namespace name 'Utilities' does not exist in the namespace 'GPE' (are you missing an assembly reference?)

EDIT

I added this at top of my master page:

<%@ Register Tagprefix="GpeIntegration" Namespace="GPE.Utilities" Assembly="GPE.Utilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6dd8f89f9df3b99" %>

And I got following error:

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

I also tried with:

with same result.

share|improve this question
add comment

2 Answers

you should register your custom DLL in the beginnig of the master page like this:

  1. YourPrefix - whatever you'd like
  2. DLLNameSpace - in your case GPE.Utilities.Integration
  3. AssembyName - right click on the project which generated your DLL and properties.
  4. TOKEN - should be taken from DLL. To do this go to Start->All programs->Microsoft Visual Studio->Visual Studio Tools->Developer Command Prompt. Run this and type sn -T PathToYourDLL.

Hope it helps,

Andrew

share|improve this answer
    
I edited my question with results of what you suggested, with no luck. –  jjczopek Mar 6 '13 at 12:52
    
Namespace should be a full path to your class so in my opinion it should be like <%@ Register Tagprefix="GpeIntegration" Namespace="GPE.Utilities.Integration" Assembly="GPE.Utilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6dd8f89f9df3b99" %> –  Andrew Adamich Mar 6 '13 at 13:11
add comment

I would have build a user control that includes that button and references the utilityclass. In that case you only have to reference the user control (or a delegate control) in the master page and not having code directly in the master page. Much cleaner and you will not have a lot of reference problems to DLL:s..

//M

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.