[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Ambiguous assemblies / DLL

Posted on 2011-02-18
8
Medium Priority
?
2,133 Views
Last Modified: 2013-12-17
I was trying to implement URL re-writing as described in approach #3 here: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

I'm quite sure I know what the problem is here, but no clue how to fix it.  I know from the error and searching online that basically my app DLL is conflicting with my temp .net files DLL, but I can't seem to figure out how to clear it.

I cleared my app DLLs
I cleared my temp DLLs
I deleted my bin folder
I checked my namespace was right
I Google'd every possible thing I could think of

I didn't rename the class (because I don't believe I should have to do that or want to)


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The type 'HotAtNight.FormRewriterControlAdapter' is ambiguous: it could come from assembly 'C:\Users\Michael\AppData\Local\Temp\Temporary ASP.NET Files\root\ab131887\4c4d66a4\App_Code.nuegskxp.DLL' or from assembly 'C:\inetpub\HotAtNight\HotAtNight\bin\HotAtNight.DLL'. Please specify the assembly explicitly in the type name.

Source Error:


Line 3:    <browser refID="Default">
Line 4:      <controlAdapters>
Line 5:        <adapter controlType="System.Web.UI.HtmlControls.HtmlForm" adapterType="HotAtNight.FormRewriterControlAdapter" />
Line 6:      </controlAdapters>
Line 7:    </browser>

Source File: C:\inetpub\HotAtNight\HotAtNight\App_Browsers\Form.browser    Line: 5

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace HotAtNight
{
    public class FormRewriterControlAdapter : System.Web.UI.Adapters.ControlAdapter
    {
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            base.Render(new RewriteFormHtmlTextWriter(writer));
        }
    }
}


using System;
using System.IO;
using System.Web;
using System.Web.UI;

namespace HotAtNight
{
    public class RewriteFormHtmlTextWriter : System.Web.UI.HtmlTextWriter
    {
        public RewriteFormHtmlTextWriter(HtmlTextWriter writer)
            : base(writer)
        {
            this.InnerWriter = writer.InnerWriter;
        }

        public RewriteFormHtmlTextWriter(TextWriter writer)
            : base(writer)
        {
            this.InnerWriter = writer;
        }

        public override void WriteAttribute(string name, string value, bool fEncode)
        {
            base.WriteAttribute(name, value, fEncode);

            // If the attribute we are writing is the "action" attribute, and we are not on a sub-control, 
            // then replace the value to write with the raw URL of the request - which ensures that we'll
            // preserve the PathInfo value on postback scenarios

            if (name == "action")
            {
                HttpContext context = HttpContext.Current;

                if(context.Items["ActionAlreadyWritten"] == null)
                {
                     // Because we are using the UrlRewriting.net HttpModule, we will use the 
                    // Request.RawUrl property within ASP.NET to retrieve the origional URL
                    // before it was re-written.  You'll want to change the line of code below
                    // if you use a different URL rewriting implementation.

                    value = context.Request.RawUrl;

                    // Indicate that we've already rewritten the <form>'s action attribute to prevent
                    // us from rewriting a sub-control under the <form> control

                    context.Items["ActionAlreadyWritten"] = true;
                }
            }
            base.WriteAttribute(name, value, fEncode);
        }
    }
}

Open in new window

0
Comment
Question by:codemonkey21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 34930236
You have 2 dll's with the same "qualified name", but which may differ by filename, that are accessible to your application. Have you installed anything to the GAC? There are two paths described in the error message and you should clear those paths of any conflicting DLLs.

And you are right, you shouldn't have to rename the class   = )
0
 

Author Comment

by:codemonkey21
ID: 34930421
I don't think I'm using the GAC, if I am, I didn't do it willingly.

Now I've tried clearing the DLL's with no luck before.
0
 

Author Comment

by:codemonkey21
ID: 34930889
Would using the publickeytoken on <adapter controlType="System.Web.UI.HtmlControls.HtmlForm" adapterType="HotAtNight.FormRewriterControlAdapter" /> have any affect? (not that it would matter, the sn.exe file isn't on my computer and I've looked in all the SDK folders.)
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34931018
Did you try clearing the files in C:\Users\Michael\AppData\Local\Temp\Temporary ASP.NET?  Safe to empty that folder.  If you've got a web project you can right-click on the project in the Solution Explorer and choose clean.
0
 

Author Comment

by:codemonkey21
ID: 34931064
Yea, I've tried both methods. No luck.
0
 

Accepted Solution

by:
codemonkey21 earned 0 total points
ID: 34931243
I'm such a bone head! I was using the App_Code folder in a web application and that was the reason it was causing the conflict. As soon as I renamed the folder to something else, compiled fine.
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 35913527
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question