NXuan636559 (Community Member) asked a question.

I have used HttpUtility.HtmlAttributeEncode() For Id but still has problem with CWE 80

Hi supporter.

I am using WebForm Asp.net to develop application.

My code looks like:

      var hlkFile = new HyperLink

      {

        ID = "hlkFile_" + fieldInfo.Name,

        Text = fileUploadInfo.Filename,

        NavigateUrl = "#"

      };

And Veracode pointed out that my code has problem with XSS.

 

Then I changed my code to:

      var hlkFile = new HyperLink

      {

        ID = HttpUtility.HtmlAttributeEncode("hlkFile_" + fieldInfo.Name),

        Text = HttpUtility.HtmlAttributeEncode(fileUploadInfo.Filename),

        NavigateUrl = "#"

      };

BUT Veracode still pointed out that my code has problem with XSS (CWE 80)

 

Can you help me understand why my code still have problem with XSS and how should I do for my code?

 

Thank you very much for your support

Yours.

Nghia

 


Topics (3)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.