Monday, July 11, 2011

How to catch requested url in the webPage

1.First Open a new Webapplication and name that web application as Sample.aspx.

2.In the default.aspx,add a button and name it as samplebutton.

3.Add a label to your aspx page and name it as lbMsg

4.In button_click event add the below code:

string requestedUrl = Request.Url.ToString().ToLower();
lbMsg.Text=requestedUrl;

5.You can view the requested url in the label when you click the button.

In this way,you can get the requested url in which ever server you deploy your code.

No comments:

Post a Comment