Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to
fetch the  query string parameters alone  from a Url which will be in encrypted format in asp.net with c#. 
My Sample Url is as below:
<a href="http://samplecorporateWPS.aspx?P7t0Iuy8XIhS4z6yJqY3lPniOmkIF3YhrlOQzcBwXJ5vUzTWglVzRoRrqDPClgku5gqUr1wzArs3bB76XSEHctnnqr9+LyIaLzMdKiR1ljrl4Xjhr0duzAGUgya0yX7imZaadmjVq7qsBD5+8+3wYrhKmSO6ET0Q1U+RAaNlyHU="

I want to decrypt the below data :
P7t0Iuy8XIhS4z6yJqY3lPniOmkIF3YhrlOQzcBwXJ5vUzTWglVzRoRrqDPClgku5gqUr1wzArs3bB76XSEHctnnqr9+LyIaLzMdKiR1ljrl4Xjhr0duzAGUgya0yX7imZaadmjVq7qsBD5+8+3wYrhKmSO6ET0Q1U+RAaNlyHU=

What I have tried:

<pre>My Sample Url is as below:
<a href="http://samplecorporateWPS.aspx?P7t0Iuy8XIhS4z6yJqY3lPniOmkIF3YhrlOQzcBwXJ5vUzTWglVzRoRrqDPClgku5gqUr1wzArs3bB76XSEHctnnqr9+LyIaLzMdKiR1ljrl4Xjhr0duzAGUgya0yX7imZaadmjVq7qsBD5+8+3wYrhKmSO6ET0Q1U+RAaNlyHU="

I want to decrypt the below data :
http://samplecorporateWPS.aspx?P7t0Iuy8XIhS4z6yJqY3lPniOmkIF3YhrlOQzcBwXJ5vUzTWglVzRoRrqDPClgku5gqUr1wzArs3bB76XSEHctnnqr9+LyIaLzMdKiR1ljrl4Xjhr0duzAGUgya0yX7imZaadmjVq7qsBD5+8+3wYrhKmSO6ET0Q1U+RAaNlyHU=


I tried by replacing the Url http://samplecorporateWPS.aspx? with empty string
and decrypted

Is there a even more feasible way to do the same?
Posted
Updated 5-Jun-19 22:07pm

1 solution

I would use Uri.Query Property (System) | Microsoft Docs[^]

If you really want to do it yourself, consider using string.IndexOf to find the ? if present, then using string.Substring. This will work if the URL is changed (for example to https). But I can't really see a reason to do this - just use the Uri class.
 
Share this answer
 
Comments
CPallini 6-Jun-19 4:52am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900