Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to access a localhost website from android device

I have an ASP.net Web API in my laptop with this address :

localhost:99949

I add this to IIS Express that I can access my web Api from another computer in same lan network , and it's going this:

Nimis:80

I can access to my web api from other PCs , but when I try to access this with my android device it show me "Web page not available" error.

I turn off all my firewalls.

what should I do to fix it ?

like image 795
Mas Jamie Avatar asked Oct 21 '22 23:10

Mas Jamie


1 Answers

You need to add an inbound rule in the firewall for port 80 (or whatever port you used for your website on IIS):

Go to Control Panel, Windows Firewall
Select Inbound Rules
Add a New Rule
    Select "Port" as a Rule Type
    Select "TCP and put "80" (and any other ports you want to open) in "Specific local ports"
    Select "Allow the connection"
    Select the network location where the rule should apply
    Give a name and an optional description

After that you should be able to access your site from other devices in the same network using http://computername (e.g. http://myhomepc)

However you might need to use the IP of the server machine with Android. It always seems to override its DNS entries using Google's servers. In this case try to modify DNS settings as explained here.

like image 113
2 revs Avatar answered Oct 24 '22 04:10

2 revs