Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 877185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:33:51+00:00 2026-05-15T11:33:51+00:00

I am trying to stop XSS attack so I am using html agility pack

  • 0

I am trying to stop XSS attack so I am using html agility pack to make my whitelist and Microsoft Anti-Cross Site Scripting Library to deal with the rest.

Now I am looking at encoding all html hrefs. I get a big string of html code that can contain hrefs. Accours to MS Library they have an URL encode but if you encode the whole URl then it can’t be used. So in the example they just encode the query string

UrlEncode Untrusted input is used in a
URL (such as a value in a
querystring) Click
Here!

http://msdn.microsoft.com/en-us/library/aa973813.aspx

So now my questions is how do I parse through a href and find the query string. Is it always just “?” then query string or can it have spaces and be written in different ways?

Edit

This urls will not be written by me but the users who will share them. So that’s why I need a way to make sure I get all query strings and not just ones in valid format. If it can work invalid format I have to grab these ones too. Hackers won’t care if it is valid format or not as long as it still does what they want.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:33:52+00:00Added an answer on May 15, 2026 at 11:33 am

    I believe it is always the part after the ? but you can easily use the Uri class for this:

    Uri uri = new Uri("http://foo.com/page.html?query");
    string query = uri.Query;
    

    That will include the ? itself. Of course, you can fetch the other bits as well, which could be handy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to stop using the arrow keys in vim. But instead of setting
Please stop me before I make a big mistake :) - I'm trying to
I am trying to make it stop showing the rest if $walk_jail is not
Is there a way to make a socket stop trying to connect immediately? It
I'm trying to stop a form from submitting using the submit eventlistener . My
I'm trying to stop my service from restarting itself by using the following: @Override
I just installed nginx. I am trying to stop it now using the pid
Im trying to stop using TcpTrace and start working with Fiddler. But i just
Greeting, I'm trying to stop explorer process using power-shell command: Stop-Process -ProcessName explorer -Force
I am trying to stop the loading of images with javascript on dom ready

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.