codemonkey21
asked on
Ambiguous assemblies / DLL
I was trying to implement URL re-writing as described in approach #3 here: http://weblogs.asp.net/sco ttgu/archi ve/2007/02 /26/tip-tr ick-url-re writing-wi th-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 didn't rename the class (because I don't believe I should have to do that or want to)
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.FormRewriterControlAdapt er' is ambiguous: it could come from assembly 'C:\Users\Michael\AppData\ Local\Temp \Temporary ASP.NET Files\root\ab131887\4c4d66 a4\App_Cod e.nuegskxp .DLL' or from assembly 'C:\inetpub\HotAtNight\Hot AtNight\bi n\HotAtNig ht.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.HtmlContr ols.HtmlFo rm" adapterType="HotAtNight.Fo rmRewriter ControlAda pter" />
Line 6: </controlAdapters>
Line 7: </browser>
Source File: C:\inetpub\HotAtNight\HotAtNight\App _Browsers\ Form.brows er 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);
}
}
}
ASKER
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.
Now I've tried clearing the DLL's with no luck before.
ASKER
Would using the publickeytoken on <adapter controlType="System.Web.UI .HtmlContr ols.HtmlFo rm" adapterType="HotAtNight.Fo rmRewriter ControlAda pter" /> 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.)
Did you try clearing the files in C:\Users\Michael\AppData\L ocal\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.
ASKER
Yea, I've tried both methods. No luck.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
And you are right, you shouldn't have to rename the class = )