Solved

How do I HTML Decode this?

Posted on 2011-03-15
7
473 Views
Last Modified: 2012-05-11
Using C# and Server.UrlDecode() I need to decode this Uri, but I'm not quite sure how to.

http://localhost:3291/default.aspx?un=username&ts=353516603

un is the username
ts is the timestamp

Thanks,
newbieweb
0
Comment
Question by:newbieweb
  • 3
  • 2
  • 2
7 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
That URL isn't encoded. What is it you think needs decoding?
0
 

Author Comment

by:newbieweb
Comment Utility
I just need to grab the two values without using string parsing. I though there was a simple way to get the values out.
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 350 total points
Comment Utility
There is:
string un = Request.QueryString["un"];
int ts = int.Parse(Request.QueryString["ts"]);

Open in new window

The values are in the Querystring, but they aren't encoded. You would of course want to sanity check those first to make sure they are valid.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 33

Assisted Solution

by:Todd Gerbert
Todd Gerbert earned 150 total points
Comment Utility
I'm with carl_tawn, not quite sure what the question is, but taking a stab in the dark:

1. Retrieving QueryString parameters would done like: string username = Request.QueryString["un"];, or string tsVal = Request.QueryString["ts"];

2. If you just stuck "username" in there as an example, and the actual URL is http://localhost:3291/default.aspx?un=newbie%20web, then you can still just use Request.QueryString["un"] and the .Net runtime will decode it for you (in this case would get the value "newbie web").

3. If you need to manually URL decode something Server.UrlDecode should do the tring, Server.UrlDecode("http://localhost:3291/default.aspx?un=newbie%20web") = "http://localhost:3291/default.aspx?un=newbie web"

4. Need the "ts" parameter as an int and not a string, then Int.Parse it: int ts = Int32.Parse(Request.QueryString["ts"]);
0
 

Author Comment

by:newbieweb
Comment Utility
Will that parse this:

Request.Url.AbsoluteUri;

?
0
 
LVL 33

Expert Comment

by:Todd Gerbert
Comment Utility
Ahh... I type slow. ;)
0
 

Author Closing Comment

by:newbieweb
Comment Utility
Thanks!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
DLL in ASP.NET 20 38
.Net application crashing 6 19
Asp.net mvc entity issue 6 18
Convert to Hour/minute textbox and compare 3 35
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now