I have an external application (written from a different company) which fires some requests to my asp.net web application when hitting a button. My application is running on https://localhost:59917/Main.aspx. If I hit the request button in the external program it says the following:
08:53:25 Requesting web page : https://localhost:59917/Main.aspx?token=mcQYVqoe7LxmBx7jgHBq6FtXXp4uPCzX0FDZStiZDFMDd4l6oB3x5CgysXJKgy2y
So this app is now requesting my web application. I now have to get the given arguments of this request (in this example I need to read the argument token
). I found this thread and tried the following in my code behind (Main.aspx.cs):
protected void btnListener_Click(object sender, EventArgs e)
{
string token = Request.QueryString["token"];
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertToken", "alert('" + token + "');", true);
}
But this returns an empty string. Since I'm new to asp.net and web development I'm not sure if I understand the HttpRequest
class correctly. Is this even the right way to get the arguments I need?