18

I can't include Microsoft.Security.Application

using Microsoft.Security.Application;

Gives this error:

The type or namespace name 'Security' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

And yes, I clicked on Bin -> Add Reference... -> AntiXSSLibrary.dll and it added it to the Bin Folder including the AntiXSSLibrary.xml.

I rebuilt the whole website, and still nothing.

I'm using ASP .NET 3.5 C# - AntiXSSLibrary 4.0 Stable

12
  • 1
    is AntiXSSLibrary.dll the correct library? It doesn't seem to agree with you. Commented May 12, 2011 at 14:56
  • Are there any warnings/messages? Look at your output window. Commented May 12, 2011 at 14:56
  • No Warnings/Messages. And what you mean is the correct library. Offcourse it is. Commented May 12, 2011 at 14:59
  • Is there a naming conflict? A class called Mirosoft? Try adding the namespace using global ( using global::Microsoft.Security.Application; ) Commented May 12, 2011 at 15:00
  • 1
    Right mouse button on your website -> Convert to webapplication (for me this solved alot of problems coming with Website projects in the past) although i dont really understand why. Else, create a new website and try and reproduce the problem. If you cant, try and find the differences Commented May 12, 2011 at 16:33

7 Answers 7

30

If you get this nuget all extention objects are visibles

Install-Package AntiXSS

it solves my problem.

html = Microsoft.Security.Application.Encoder.HtmlEncode(model.SiteName), model = Microsoft.Security.Application.Encoder.HtmlEncode(json),

Sign up to request clarification or add additional context in comments.

Comments

5

Uninstall and re-install AntiXSS:

Tools --> NuGet Package Manager --> Package Manager Console (UI may differ if using other than Visual Studio 2013):

Uninstall-Package AntiXSS
Install-Package AntiXSS

For multi-project solutions, be sure to set the default project to whichever one is experiencing the problem. Use Uninstall-Package -Force AntiXSS if uninstall fails and if you can handle any package dependency problems that may arise, though I know of none for this package.

Comments

2

Right mouse on your website -> Convert to webapplication. See: How To Convert ASP.NET Website to ASP.NET Web Application

Comments

2

If, like me, you're using AntiXSSLibrary in a class library via Nuget, and got the above error:

  1. Remove all external references that you had through Nuget
  2. Remove the Nuget package file - which is packages.config found in the solution's root directory
  3. Remove the packages directory - again in your solution's root directory
  4. Reinstall all your components again

Comments

1

The answer here helped me. I found the AntiXssLibrary.dll on my site's bin folder.

Comments

1

Install-Package AntiXSS from Tools --> NuGet Package Manager

Comments

0

You are using using Microsoft.Security.Application;

Try this using System.Web.Security.Application;

For me, it was the other way round. I think it is due to different versions of my AntiXSSScripting dll I'm using.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.