Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
URL Rewrite with HttpContext.RewritePath
Old 04-18-2009, 02:19 PM URL Rewrite with HttpContext.RewritePath
Extreme Talker

Posts: 246
Trades: 0
My understanding is that with URL rewriting you can have a URL that looks like this:

http://url.com/page.aspx?param=value

and turn it into the following for the client to see:

http://url.com/the_most_amazing_page.aspx

I have tried the following in both the page load and application begin request events but nothing changes.

HttpContext context = HttpContext.Current; context.RewritePath("/test/test.aspx", false);

If I look at the value for context.Request.FilePath it is /test/test.aspx however the url has not changed. What am I doing wrong or what am I missing.
stbuchok is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-18-2009, 02:38 PM Re: URL Rewrite with HttpContext.RewritePath
Extreme Talker

Posts: 246
Trades: 0
I think I've just realized that I haven't thought this through. It looks like the url rewriting is only visible on the server side and never rewrites the clients url. If I want the above to work the way I want I'd actaully need to add rewrite rules and urlmappings in the web.config.

By doing what I said programmatically just on pageload then the client would end up getting an 404 error when they tried to bookmark the page and go back to it.

I can't use the mappings as I am applying encryption that changes and could be different for the same information.

So basically I think I'm scrapping the idea of rewriting the url for the client.
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 05-07-2009, 03:52 PM Re: URL Rewrite with HttpContext.RewritePath
Novice Talker

Posts: 5
Name: John
Trades: 0
the best solution i suggest is using ISAPI
rams0b is offline
Reply With Quote
View Public Profile
 
Old 05-07-2009, 03:57 PM Re: URL Rewrite with HttpContext.RewritePath
Novice Talker

Posts: 5
Name: John
Trades: 0
Or may be you can use Global.asax
rams0b is offline
Reply With Quote
View Public Profile
 
Old 05-25-2009, 04:01 AM Re: URL Rewrite with HttpContext.RewritePath
Novice Talker

Posts: 9
Trades: 0
to enhance the question:

I do URL-rewrite in GlobalAsax, but it only works if the pages ends with aspx, so
..../test/bla.aspx works, but I would like to have it .../test/bla/.

This doesn't work since GlobalAsax is called only for identified .NET content. -> file doesn't exist message.

Does somebody has a solution workarround?
sabsch is offline
Reply With Quote
View Public Profile
 
Old 05-26-2009, 01:18 PM Re: URL Rewrite with HttpContext.RewritePath
Novice Talker

Posts: 5
Trades: 0
Quote:
Originally Posted by rams0b View Post
the best solution i suggest is using ISAPI
yeah, just use ISAPI and the problem is solved
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
han55 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to URL Rewrite with HttpContext.RewritePath
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.60864 seconds with 12 queries