Click here to Skip to main content
14,827,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all

is there any way by which i can redirect a url to another url,if the existing url is among the list of prohibted urls....
i am writing the code in c++.so if any body has any idea regarding it..plz help....
i wan the code to work for all web browser....that's the key factor..
let suppose i write in the URL address as "www.google.co.in".and this URL is already i the list of blocked lists.so according to my application it will redirect this request to a default page,let suppose the default page would be"www.codeproject.com"...
plz help me.....
Posted
Updated 3-Jul-11 19:54pm
v2

1 solution

I guess you already have that list of blocked sites and you are writing code for block them and redirect to your default redirecting site..

It is a very basic functionality of a standard firewall...

Well for blocking or allowing any site requested from the browser you must capture those request and take action... and i think you already wrote the code for this, it is a firewall program actually. (If you are having problem in writing firewall then ask me)

For redirection there is a HEADER in HTTP specification called LOCATION you need to set this header by your desired redirecting site like "www.codeproject.com" in your response.

Otherwise you can use meta redirect. (Which is easier way...)



<title>Your Page Title


Optional page text here.
this site is blocked and you are redirection to codeproject.com




Here 5 indicates how many seconds you want to wait before redirect, meanwhile you can show a message that, this site is blocked and you are redirection to codeproject.com


Good Luck ;-)
   
Comments
vaibhavbvp 25-Jul-11 1:54am
   
hi sir..thanx for your kind response,ya its exactly a firewall,but unfortunately i dont know how to make a firewell..please send me some sample codes of firewll for blocking,it wud really be very helpful for me,i am really stucked off in this problem,and still have not got the ans,though i know the theme but i dnot know how to make the firewall.please help the needy..hoping for your kind response...
Ashish Tyagi 40 28-Jul-11 10:09am
   
Hello Vaibhav, I was very busy when you commented on it, now I am developing code for you and hopefully I will add it as an artical. just give me some time. Mean while do some work on sockets and blcking/non-blocking IO's. And are a student or working?
Ashish Tyagi 40 28-Jul-11 11:04am
   
And also read this http://en.wikipedia.org/wiki/SOCKS
vaibhavbvp 29-Jul-11 10:45am
   
Hi Sir
thanx for your such a great help for me,i am a student..sir i now the basics of network programming.Sir i have tried to find your email,but could not findit would be nice for me if i could get your email address
Ashish Tyagi 40 29-Jul-11 12:23pm
   
Don't call me sir, I am your friend. I am on ashishtyagi40 at gmail
vaibhavbvp 31-Jul-11 0:58am
   
Okay,i will contact you from email too...

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




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