Reply
permanenet link
Old 06-04-2006, 01:20 AM permanenet link
Experienced Talker

Posts: 34
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
 
When You Register, These Ads Go Away!
     
Old 06-04-2006, 08:12 AM Re: permanenet link
Minaki's Avatar
Cheerleader

Posts: 1,626
Location: Guildford, UK
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!"
Inoxia Pyrotechnics Supplies | Surrey Angels Cheerleading Squad
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 06-07-2006, 07:46 AM Re: permanenet link
Experienced Talker

Posts: 34
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, 05:32 PM Re: permanenet link
Minaki's Avatar
Cheerleader

Posts: 1,626
Location: Guildford, UK
- 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!"
Inoxia Pyrotechnics Supplies | Surrey Angels Cheerleading Squad
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to permanenet link
 

Thread Tools

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

vB 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.12533 seconds with 13 queries