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
Old 06-04-2006, 02:20 AM permanenet link
Experienced Talker

Posts: 34
Trades: 0
I am going to make a permanent link for my articles is it possible
i.e. I am going to make ‘http://www.mydomain.com/article.aspx?id=15” to “http://www.mydomain.com/1500.aspx
Is it possible?
s2002 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-04-2006, 09:12 AM Re: permanenet link
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Yes, it's possible.
This is best done in the Application_BeginRequest routine in global.asax.
You can read the URL that was requested like this:
Code:
  Dim CurrentHTTP As HttpContext = HttpContext.Current
  Dim RequestedPath As String = CurrentHTTP.Request.Path
Then you'd have your logic to work out where it's going... and then all you need to do is re-write the path, i.e.

Code:
CurrentHTTP.RewritePath("/folder/page.aspx?ID=" & ID)
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 06-07-2006, 08:46 AM Re: permanenet link
Experienced Talker

Posts: 34
Trades: 0
Thanks For your Reply,
but would you please write it in Simple steps,Which I Follow.
s2002 is offline
Reply With Quote
View Public Profile
 
Old 06-07-2006, 06:32 PM Re: permanenet link
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
- Open global.asax (or if it doesn't exist, create it. global.asax should reside in the web application root)
- In the function Application_BeginRequest, add the code from my first code block above (Again, if the function doesn't exist, create it. Here's a template: )
Code:
    Public Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
        ' Code goes here...
    End Sub
- At this point, the variable RequestedPath will hold the value of the path that was initially requested, for example "/1500.aspx"
- You then need some code to work out where that path should actually be going. That's up to you.
- Then you just need to use CurrentHTTP.RewritePath(NewPath) replacing NewPath with whatever you worked out the new path to be.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to permanenet link
 

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.52818 seconds with 12 queries