How to capture URL in a string using VB.Net?

I have a query in a dataset that is used to navigate from a gridview on a Master page to a detailview on the Details page. The query returns a URL like this:

details.aspx?ProductID=365

What is the best way to capture that url and use it again? What I want to do is capture it, cut out everything except the 365 and use it to insert into another table. I don't know when to capture it (before the details page loads? after?) or how to capture it.


Thanks,

MH
LVL 7
MHenryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bchoorCommented:
Dim ProductID As Integer = Convert.ToInt32(Request.QueryString("ProductID"))

HTH
~BC
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bchoorCommented:
BTW, Use it in Page_Load event
0
Bob LearnedCommented:
If you want the entire URL, then try this in the Page_Load:

   Dim url As String = Request.RawUrl

Bob
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Elvio Lujan.Net Senior DeveloperCommented:
Dim S As String = Request.UrlReferrer.AbsolutePath.ToString & Request.UrlReferrer.Query.ToString
0
MHenryAuthor Commented:
I'll have to check these later tonight.

Just at a glance (and being new to this) I think bchoor is on the right track. I do want it to be an integer. But I don't want the whole string, just the number at the end of the URL, the 365.

Does that make sense?

Best,
MH
0
Elvio Lujan.Net Senior DeveloperCommented:
then the way is bchoor solution
0
MHenryAuthor Commented:
Sorry for the delay, took a while for me to figure out how to test it.

bchoor's solution worked perfectly. Thanks for all the help!

Best,

MH
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.