I want to make an application that can push ads (website) to client..
Here is the case : Client try to connect to internet via wifi. Once the client is connected, server send a website address to client, and a popup (website sent by server) will appear in the client's computer in default browser.
I can list all IP connected to server, but i don't know how to push the website to client
Thanks
Here is the code to list all IP connected to server : (import System.Net library)
开发者_StackOverflow社区 String strHostName = "";
if(args == null || args.Length == 0){
strHostName = Dns.GetHostName();
MessageBox.Show("Local Machine's Host Name: " + strHostName);
}else{
strHostName = args[0];
}
IPHostEntry ipEntry = Dns.GetHostByName(strHostName);
IPAddress[] addr = ipEntry.AddressList;
int i = 0;
while(i< addr.Length){
MessageBox.Show("IP Address "+i+": "+addr[i].ToString());
System.Math.Max(System.Threading.Interlocked.Increment(ref i), i - 1);
}
It sounds like you maybe want to create some form of a Captive Portal.
http://en.wikipedia.org/wiki/Captive_portal
Captive Portals are the type of site you see when you connect to a wifi network and it asks for payment or some other form of authentication regardless of what site you attempt to navigate to.
If your intent it to actually serve the user agent's requested page in addition to serving them a popup ad, you would need to intercept this request, and insert some javascript into the page that would trigger the popup, and return this modified markup to the user agent.
精彩评论