I have a website setup in IIS and i add web application under the website. I publish and copy an existing a .Net web application files (aspx file format) over to the web application folder.
When i try to browse the web page from IE, it says
"Protocol Type: localhost"
"Windows does not recognize this Protocol."
When i try to browse from firefox, it says
"The address wasn't understood"
"Firefox doesn't know how to open this address, because the protocol (localhost) isn't associated with any program."
but when i go to url and click enter (Refresh doesn't work) from firefox, the page works and show the content.
Can anyone please point me the direction of fixing this issue?
Browsers look in the beginning of the URL for the protocol that they should use when opening a specific link (And most have functionality to execute other programs if the protocol is not one they understand).
Normally, the protocol is something like "http:", "ftp:", "file:", "irc:", etcetera.
The protocol is delimited by a colon. Your use of localhost:80/... is tripping the browser into thinking that the protocol you are trying to use is "localhost", which is not correct. If you were to leave the port number out, chances are the browser would assume HTTP with default settings (port 80) and it would work fine, seeing as most browsers will assume HTTP if the protocol is not specified.
"localhost" is not a protocol, it is the name of a server. Your problem is that a colon can serve two functions is a URL: it can separate the protocol from the server, and it can separate the server from the port. You can often leave off the protocol and we assume it is "http". If you have a port number -- "80" in your example -- you must specify the protocol, or we'll confuse the server name for a protocol.
In this example, instead of writing just
localhost:80/AdministrationWebPage/etc
write
http://localhost:80/AdministrationWebPage/etc
If Firefox figures it out, well, good for Firefox, but without the "http://" it's not technically correct.
That is, the general format of a URL is:
protocol://server:port/page?querystring
Browsers and servers will fill in defaults if pieces are missing. But among the rules is that the first colon is supposed to mark the end of the protocol, so:
localhost:80/AdminsitrationWebPage/etc
looks like protocol=localhost, server name=80, which I presume is not what you wanted.
I got the message above too without inserting the forward slash after I install the apache webserver and test the testing.php file in the htdocs folder
The way I solved it is simply to insert the forward slash as follows:
localhost:8000/testing.php
and the content of the testing.php file shows up
Related
I'm editing two websites for my client. He asked for a HTTPS connection.
While one is working perfectly we have a problem in another one (same IP address, same certificate).
First website throws an error in browser, other one is fine.
I even made a SSL Report by ssllabs.com and I checked the differences, everything should work fine.
Here is a screen from test:
DIFFCHECKER SSL COMPARSION
Client get ERR_CERT_COMMON_NAME_INVALID on both Mozilla Firefox and Chrome as in thread name.
I guess something is wrong with website, but i don't get it at all.
Is there anyone who had similar problem or could look at both and tell me where should I search for problems?
Actually I figured this out.
Client was connecting via www.domain.com while I was connecting via domain.com.
SSL wasn't configured by default to support www before the domain name.
Why first website was working for client and second not? Because he connected to first one via www and he didn't while connecting to another one. And browser remembered that choice.
Always check SSL Wildcards fellas!
We have a local instance of IIS 7 running with a website. Instead of the default "localhost" we have something like, mysite.compname.com. This is a separate entry into IIS 7 and the default website was removed to prevent confusion.
Then in our host file we an entry like this:
127.0.0.1 mysite.compname.com
Now when I try to hit this url, http://127.0.0.1/ApplicationName/Project/AddProject.aspx technically it should work, but instead I get a 404. I can vouch that this isn't a problem with the application, because if I navigate to http://mysite.compname.com/ApplicationName/Project/AddProject.aspx it works fine.
My end goal is to be able to give someone my computer name, so that they can visit a test page, so the url above I think would get turned into this http://computername/ApplicationName/Project/AddProject.aspx. Any help or at least links to understanding would help because I'm not sure where my issue is coming from.
It sounds like the IIS site / application is configured using a Host Header.
This means that the site will only respond if the host header sent by the browser matches the one configured for the site.
This is a standard method to allow one server to host sites for many host and domain names.
If you wish to allow others to view the site on your computer you will need to either have a local DNS server which you can edit, or, probably the easiest option, get them to edit their host files to include
<your IP> mysite.compname.com.
Remember to open the requisite ports (probably only 80, maybe 443 for https) in your firewall.
Or, you can try to edit the site config to remove or modify the Host Header requirement. See the first link for details, but be careful, it's easy to break things if you don't know the entire architecture of the site.
I have IIS installed in my local machine. When I have my IE settings to use a corporate proxy pac script, when I browse http://127.0.0.1 instead of going into my IIS it goes to http://10.114.5.20/. If I set my IE settings to a manual proxy (with the bypass proxy by local adress checked) the http://127.0.0.1 show my IIS application.
Any ideas what is wrong with the original settings? How 127.0.0.1 gets redirected to another IP? Where to look?
My computer is w7 64 bits laptop.
Don't know who is 10.114.5.20. It is not my local ip. It is not any of my dns servers. It is not my default gateway.
Pac script could return two proxies: or 10.114.5.11 or 10.114.5.14. Not sure what the 10.114.5.20 machine could be, maybe it is the default gateway of the proxies...
Just a last update:
I download and saved the PAC script locally, and changed the http://... URI to a local file://C:/... one. And surprisingly enough, it worked. I mean the http://localhost now goes to my computer, not to the strange http://10.114.5.20/.
Reading the PAC script file I notice that when opened with Notepad all text goes into one line, but opening with Wordpad I see several lines. Opening in binary, the carriage return is a unix style one (0A) instead of the windows one (0D0A).
So I supose the explanation comes down to say the Automatic configuration script setting in IE doesn't understand unix style carriage returns When parsing the pac script, so it always returned the proxy, never DIRECT.
The problem is in the corporate proxy pac script. It does not allow the "bypass proxy for local addresses".
Try ping -a 10.114.5.20 or tracert 10.114.5.20 to try to figure out who is at that address.
FYI... if you want to use the default settings for the proxy, then don't use "localhost", instead, use your real IP address. The Proxy server should redirect the request back to your own machine.
Sounds like corporate IT has an entry in your hosts file that's redirecting you.
Open Windows Explorer and browse to C:\Windows\System32\drivers\etc. Open the hosts file with Notepad or another text editor. Do you see an entry that directs http://127.0.0.1 somewhere else?
If so, commenting that out should fix the issue.
I have an ASP.NET application running on a web host. There is some logic that is calling on
(HttpRequest)Request.Host.Url
to dynamically construct some URLs for use in anchor tags. On my local dev environemnt, the result is as expected, namely "localhost" for Host.Url.
However, on the production server, it is not as I would expect. The URL of the page I am loading looks like:
http://www.example.com/forms/someform.aspx
The logic that uses HttpRequest.Url.Host is building some links for the page, and the result is actually:
http://www.example.com.z82.webhostname.com/forms/somfform.aspx
What could cause this? I was under the impression that HttpRequest.Url.Host was based on the http request headers, which in the case of the page load is the basic www.example.com.
If the webhost used some sort of proxy server to re-direct the request (as opposed to the DNS resloving directly to the responsible ASP.NET server), would that result in this problem? Or could it be something else?
I have observed similar behavior but I don't understand well why .NET/IIS is handling the request in such a strange way. Another interesting test is to use Request.Url.ToString() which will report one address and then use string.Replace() (or another string method) which will report a different address.
It seems to be related to DNS records (environment settings in general).
I believe what Request.Url.Host is portraying is whatever reverse DNS the TCP stack of your client happened to come across. The same thing happens if I ping www.google.com; I get Pinging www.l.google.com [74.125.227.51] with 32 bytes of data.... Not the same host.
If you want the exact host name that was typed into the browser's address bar, use the HTTP Host header: Request.Headers["Host"]
Note that Request.Headers["Host"] will include a port number if present in the address bar, so if you're expecting the host name only, use Request.Headers["Host"].Split(':')[0].
I have some knowledge on my question but not exactly. What exactly programatically happening after http request?
Scott Hanselman said in one of his blog posts:
Describe, in as much detail as you think is relevant, as deeply as you can, what happens when I type "cnn.com" into a browser and press "Go".
My question is exactly this,
That's like asking "describe how to perform a coronary bypass". Yes, one can explain how, but one is better first studying medicine and learning about the basics, before starting with specific procedures. However, in bulletpoints:
Your browser will want to know the IP address of cnn.com. It doesn't do DNS lookups itself, but rather asks the operating system.
Your browser will connect to that IP address on port 80
Your browser will send a HTTP GET request
The webserver will reply with statuscode 200 and the body contents
Your browser will parse the HTML
In the HTML, other resources (images, scripts, css-files...) might be included, which the browser will also fetch.
After the browser is done, it will close the connection. If it doesn't, the webserver will.
Browser tries to resolve the name cnn.com into its ip address.
Browser TCP connects to cnn.com's ip address on the default HTTP port (80)
Browser sends a GET request to the server, asking for the / page
Browser says that it's trying to connect to "cnn.com" (cnn.com and bbc.com could be hosted on the same hosting company, with the same IP address)
Browser also says what's your browser, browser engine, browser version, operating system and the plug-ins that you have installed.
Server sends a header saying what's coming on your reply, the kind of data you're going to receive (in this case, HTML), and the size of the response if it's available.
Server closes the connection if there isn't any keep-alive instruction from the browser. Otherwise it will use this opened connection to ask for other things that might be needed (images within the page, for example.)
By the way, download and install Wireshark if you want to go deep and see what's really going on behind the curtains.