Glews Glews - 1 month ago 13
ASP.NET (C#) Question

Stored procedure parameter value from url value Webform C#?

I'm wondering if it's possible to get a parameter for a stored procedure from an URL. For example, let's say my
URL is

www.WebPage.com/results
and I want a client to be able to enter something like
www.WebPage.com/results?param1=306
in the web browser and the site displays the stored procedure with parameter 306.

I already know how to display the data i just need the parameter value from the URL. Thank you!

Answer

If you are using asp.net and not MVC then you can create the URL as www.webpage.com/results.aspx?ParamName=Value.

You can then use Request.Querystring[ParamName].ToString() on the page load of your page to retrieve the value again.

If the data you are sending is sensitive, make sure you encrypt it first.