Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hello,

I am fairly new to vb.net and am now trying to create something in ASP. What I want to do is create a pageless app that would run on a server. It would detect what url a request comes from, I understand that Request.ServerVariables("HTTP_REFERER") would do the job. Then, take that piece of data, do a query in an Access (2007) database, and redirect the viewer to a new URL. I understand the code for that is Response.Redirect(New URL).

What I can't get my head around is how start framing the code for this. There will be at any given time 100's of URL's that are being detected and redirected and that will change on a daily basis, so I can't put this in the code directly.

Can anyone give me some direction on this?

Your help is much appreciated.
Posted
Comments
Herman<T>.Instance 11-Aug-11 13:43pm    
why don't you create a webservice for this?

Hi,

For this, you can use a HttpModule which will handle every request to your page. There you can implement your functionality (check from where the user is coming, which URL he requested and so on..).

Here is a Example from Microsoft (don't bother about the .net Version, as far as I see there should be nothing wrong in the example):
http://msdn.microsoft.com/en-us/library/aa719858%28v=vs.71%29.aspx[^]

Also I some month ago I wrote a blog entry about a URL rewriter (this does mostly the same ;)):
http://blog.dotnetcorner.ch/post/2011/03/30/How-to-Create-an-easy-and-flexible-URL-Rewriter.aspx[^]


Hope this helps.


Best regards and happy coding,
Chris
 
Share this answer
 
Comments
TomSeemore 11-Aug-11 15:05pm    
Thank you. Thats a huge step in the right direction. Now all I need is to sort out the SQL code and I should be able to get going. Much appreciated help!
Christoph Keller 11-Aug-11 15:07pm    
You're welcome :)

If the answer helped, please mark it as "answer". Thank you :)
I will have to set about learning how to do that. It's a new idea to me.

Thank you.
 
Share this answer
 
You can Rewrite the URL. In MVC it is done automatically using Routing and you can extend it.
For ASP.Net have a look on the URl URL Rewriting in ASP.NET[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900