Application System
Application System

Reputation: 1

Request.Form Question

There is an aspx page in the project. And one line is below;

value = Request.Form("xxx")

How can I learn where post is coming? From which page the post is coming?

Upvotes: 0

Views: 164

Answers (4)

bottlenecked
bottlenecked

Reputation: 2157

If you don't have the debugger stopped at that line, and the page where the line value=Request.Form("xxx")" (note: this looks more like VB to me) resides is Page1.aspx, then you could search your entire project/solution for something along these lines

action\s*=\s*['"].*Page1.*> using for example visual studio's Find (Ctrl+F) and checking Use:RegularExpression

Edit: this will try to find the form that posts to the page using the form's action attribute

Upvotes: 0

Davide Piras
Davide Piras

Reputation: 44605

in the Page_Load you can check the current handler if not post back, see here:

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var currentRequest = HttpContext.Current.Handler;
            }
        }
    }
}

if you debug this you will see the value of the currentRequest object, it's the calling page and if you come to a webform with a Server.Transfer or Response.Redirect this is the usual way to grab some data from the calling webform.

as in other answer, of course, anytime, you can and should check the properties of the Request object, like RawUrl and so on... :)

Upvotes: 1

Random Dev
Random Dev

Reputation: 52270

have a look at the documentation here you should find the information in Request.RawUrl Property

Upvotes: 0

62071072SP
62071072SP

Reputation: 1935

try this

  if(IsPostBack)

       {

             Label1.Text=Global.GetPostBackControl(this).ID.ToString();

       }

Upvotes: 0

Related Questions