I was wondering something. In ASP.NET we can have Inside aspx page something like this :
string ref = Request["ref"];
We can have the same thing going in code behind Inside the load of our page with the same type of request.
But is it possible to retreive this value in a C# class (admiting something like toto.cs) ?
Because a Request won't work on a .cs, we already supose to be in the serveur side.
So how would it be done ?.
Edit :
seeing answer and comment, I should have had that toto.cs in this case is not link with the aspx page. It is only a random .cs class in the App_Code repository in a Web project.
Assuming the toto.cs
will always be used in conjunction with ASP.Net, you can use the HttpContext
object to get the current context and access the Request
as in the code behind of a page.
Something like HttpContext.Current.Request.QueryString["ref"];
.
HttpContext
is located in System.Web
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With