IIS replaces host of links in web page - asp.net

I have an static html file with some links to: http://example2.com/url
The html file is hosted in other site: http://example.com/app/index.html
If I access the file locally, e.i. in the IIS server. All the links point to the correct Urls (http://example2.com/url). However if I access the site from another machine all the URL links in file index.html are replaced with: http://example.com/url
I am sure this error is related to some configuration mistake but currently I am completely lost.
Any help be will really appreciated

Related

point to virtual directory in IIS

I apologize if I am not using the right technical terminology, but I am trying to be as clear as possible, I hope my post makes sense.
I have added a local classic ASP website in IIS 7.5
Sites
csr < website
The physical files location: c:\projects\webapps\csr
The URL in the browser: http://localhost:82/orders.asp?.....
My question is: how do I have to change the configuration if I want the website to open in the browser using the following URL: http://localhost:82/csr/orders.asp?....
Thanks.
Change the website's path to c:\projects\webapps. Then http://localhost:82 will point to c:\projects\webapps and http://localhost:82/csr will point to c:\projects\webapps\csr
If you want http://localhost:82 to point to some other folder, that's fine too. Just add a virtual directory to the website, name it "csr" and give it the path c:\projects\webapps\csr, and you'll be able to browse to http://localhost:82/csr.

web.config file not there in the root(/) directory

I was trying to run a .cshtml file but it gave an error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /index.cshtml
So I searched for the solution and found that I had to edit the web.config file which is in the root directory(here it is My Site), but there is no file like that there there is only an index.cshtml which I had created.
I searched even the IIS and the IIS Express folders in Programs Files\ but there was no file like that?
If you are using WebMatrix, maybe your mistake was the starting point choice.
If you want to create a new Web Pages site you must start from a template in the Template Gallery of WebMatrix. Pay attention that the Empty Site template differs from the Empty Site option outside the Template Gallery because the first holds the files (binaries, packages and the web.config too) that are needed.
As the server error suggests, .cshtml files are not served, the reason for this is because they are server-side files that make up your application, they are just one piece of a much bigger picture.
If you launched your web application in debug mode and the URL in the browser was something like http://localhost:2932/Views/Home/Index.cshtml, just drop the /Views/Home/Index.cshtml part of the URL.

File not found in an asp hosting

I recently uploaded an asp web site on aspspider , I uploaded to the webroot two files
UniversityRDF.rdf
UniversityRDFS.rdf
But for unknown reason to me , I can't reach them when I browse to
www.aspspider.ws/#####/UniversityRDFS.rdf
or
www.aspspider.ws/#####/UniversityRDF.rdf
how can I fix it ?
IIS might not be configured to allow rdf files to pass through. If you put a simple html file, can you see that?

File not found error in Asp.net 4.0

On Local host,my solution works fine but on server when i deploy ,it gives that file not found error. and the error message is something like this.http://localhost:27375/favicon.ico
I don't have any such file in my application.I tried to create on in the root folder but no luck.any help is highly appreciated
Your favicon.ico file should be in your root directory for the web site.
It looks like your application is still trying to connect to the localhost in order to display the favicon. Are you hard-coding your URL to the favicon with a http://localhost:27275/favico.ico address?
To build on what Internet Engineer said, using ASP.NET, you can use a relative path prefaced with ~ or /. So, you can use ~/favico.ico or /favico.ico in order to reference your icon file.
First check in web server if you can see the file directly in the browser:
http://productionwebsite/favico.ico
If the file is there, now you need to check that the code is using relative paths. Most likely this is coded using absolute paths.

Custom VirtualPathProvider unable to serve URLs ending with a directory

As part of a CMS, I have created a custom VirtualPathProvider which is designed to serve a single file in place of an actual file structure. I have it set up such that if a file actually exists on the server, that file will be served. If the file does not exist, the virtual content stored for that address will be served instead. This is similar to the concept of serving a website from files stored in a database, though in this case the content is stored in XML files on the server.
This setup works perfectly when a request is made to a specific page. For example, if I ask for "www.mysite.com/foobar.aspx", the content that is stored for "foobar.aspx" will be served. Further, if I ask for "www.mysite.com/subdir/foobar.aspx", the appropriate content will also be served.
The problem is this: If I ask for something like "www.mysite.com/foobar", things begin to fall apart. If the directory exists on disk (and doesn't have a configured default page in IIS, such as index.aspx), I will get a "Directory Listing Denied" error. If the directory does not exist, I'll simply get a 404 - Resource Not Found.
I've tried several things, and so far nothing I've done has made a bit of difference. It seems as though IIS is simply noting the nonexistence of a directory (or default file in an existing directory) and serving up its own error code, without ever asking my application what to do with the request. If it ever did get to the application, I would be able to solve the problem, but as it stands, I'm quite lost. Does anyone know if there is some setting in IIS that is causing this?
I've looked for every resource I can find on the subject, and am coming up empty. I know this should be possible, because I have read tutorials on serving content from both databases and ZIP files. HELP!
p.s., I am running IIS6 and .NET 3.5
IIS will only pass a request to the ASP.NET process if it is configured to do so for the particular extension. The default is aspx, ascx, etc. In other words, if you request a .html file, ASP.NET will never see that HTTP request. Likewise for empty extension.
To change this behavior, add a wildcard mapping to the ASP.NET process. Load IIS Manager, go to the Properties for your web site and look at the Home Directory tab. Click on "Configuration" and there you will see the extension-to-applicaiton mappings.

Resources