Click here to Skip to main content
16,012,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to fetch the path from the url, to a label box.

We can't hard code it, it should come from URL.
Posted
Updated 9-Nov-10 17:40pm
v2

Hi Lipsa,

C#
Label1.Text = Request.Url.AbsolutePath.ToString();


Please do let me know, if you have any doubt.

Please provide "Vote":thumbsup: if this would be helpful, and make "Accept Answer" if this would be correct answer.:rose:

Thanks,
Imdadhusen
 
Share this answer
 
Comments
Lipsa M Mishra 10-Nov-10 0:17am    
Yes its coming, but it displaying with the .aspx extension.
it should display the name which i have mentioned in the IIRF.
hance_micle 1-Dec-10 6:21am    
Good Answer
hance_micle 1-Dec-10 6:21am    
my vote is 5
You can use given code to get url path in the label box

// Get the absolute URI 
Label1.Text = HttpContext.Current.Request.Url.AbsoluteUri; 
//Get the absoulte path of URI
 Label1.Text = HttpContext.Current.Request.Url.AbsolutePath;
 
Share this answer
 
Comments
Lipsa M Mishra 10-Nov-10 0:21am    
Yes its coming, but it displaying with the .aspx extension. it should display the name which i have mentioned in the IIRF

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900