Get current friendly url from code

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
6/24/2007 8:35:36 AM
Gravatar
Total Posts 488

Get current friendly url from code

If I watch Request object in debugger, all the corresponding properties are like "/Default.aspx?pageid=18", But in my browser window I do see "/mypage.aspx". How to get currently used friendly url from code?

I need this to correctly redirect to the same page in some cases.

6/24/2007 9:02:06 AM
Gravatar
Total Posts 18439

Re: Get current friendly url from code

I believe Request.RawUrl shows the requested friendly url, whereas Request.Url shows the re-written actually used url.

Joe

6/24/2007 10:14:01 AM
Gravatar
Total Posts 488

Re: Get current friendly url from code

Request.RawUrl also shows actually used url.

I used folder-based sites, so in my case it is /myfolder/Default.aspx?pageid=18

6/24/2007 10:51:35 AM
Gravatar
Total Posts 18439

Re: Get current friendly url from code

For me Request.RawUrl shows the requested url which corresponds to what you see in the browser.

If I add aline of code like:

string test = Request.RawUrl;

into the page load of Default.aspx.cs and set a break point after it, then I request the home page by clicking the first item in the menu I see "/home.aspx"

You can easily refresh the page correctly server side with Response.Redirect(Request.RawUrl);

Hope it helps,

Joe

6/24/2007 12:26:42 PM
Gravatar
Total Posts 488

Re: Get current friendly url from code

It really contains, thanks.

I thing I have watched the debugger when url used was not friendly already, sorry fo bothering with this.

You must sign in to post in the forums. This thread is closed to new posts.