We help IT Professionals succeed at work.
Get Started

How to get url data in C#?

FairyBusiness
on
643 Views
Last Modified: 2012-08-17
Hi, I am trying to filter what gets displayed on my page according to what the user selects. For example if they click on silver the url becomes:

http://auroriella.com/showcase.aspx?metal=1

How do I grab this metal=1 from the url in my C# code? What I want to do is write a function that basically says 'all items from the table that have this metal id are collected and store in a variable that I can return'.

The query would be something like,
"SELECT ProductID, ColorID, filename, MetalID WHERE MetalId =" +

Open in new window


But I'm not sure how to take the metal=1 from the url and put it into a variable to use.  Can someone please tell me how to do this?
Comment
Watch Question
This problem has been solved!
Unlock 2 Answers and 19 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE