Click here to Skip to main content
15,923,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any difference in below scenarios:

I'm redirecting to the same page.

1) When you're in a .aspx page, and you pass only the name of the same page as a parameter Eg: Response.Redirect(abc.aspx).

2) When you're in a .aspx page, and you pass the Whole URL as a parameter
Eg: Response.Redirect(~/folder1/folder2/abc.aspx).

Thanks in advance
Posted

1 solution

No, there is no difference. They point to the same url.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 14-Jan-16 15:50pm    
5ed. I would add that relative path names are relative to the current page.
—SA
ZurdoDev 14-Jan-16 15:58pm    
Good point. I almost did but since the OP was specifically, and boldly, stating that it was the same page, I didn't see the need.
Sergey Alexandrovich Kryukov 14-Jan-16 16:47pm    
Sure...
—SA
Manoj_Baddi 15-Jan-16 7:46am    
I'm asking this because I faced an issue recently. I have a user control which I use in every aspx page i.e. set values to user control and show the components of the user control respectively. When I was passing only the name of the page, the values were not set and when I passed the whole URL, the values were set.
Although my issue was resolved, I was really confused!!
ZurdoDev 15-Jan-16 7:48am    
If you have code in a user control then for sure use ~ since you don't know where that user control will end up. For best practice, always use ~.

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