currently I have setup my page in IIS. It can be accessed over the IP address of the server only (so something like: "127.0.0.1"). What I want to do is move the page to a sub-directory, so that if someone uses the IP addess only, he won't get to the page (404 error). I would like the page to be accessible by using something like this: "127.0.0.1/someName". This should let the user access the default page, as it is now. Is this possible?
Thanks!
You are looking for Virtual Directories.
Right click the site, and click Add Virtual Directory. Give it a name (this will be the sub directory name).
Then, just make sure your virtual directory has the correct default page configured. For example, if MyPage.aspx should be the default, then put it in as the default document.
Related
In my article site some users decided to have their eMail address instead of user name
The problem starts when i'm trying to redirect to a page using RouteData and the URL ends with ".com" , for example "example#gmail.com" is a valid username so his personal page will be
http://www.mysite/user/example#gmail.com
live example
As you can see the it gets redirect to home page and relative path gets messed up, so images doesn't show
Can someone tell me why browsers don't like routedata in their url ending with .com ?
If you try ".net" or ".org" it will work, that's the issue with ".com" ?
In Windows, the .com extension is used to denote a type of executable file. Your question is tagged as asp.net - so I assume you are using IIS. IIS does not manage virtual directory names containing executable extensions such as: .vbs, .com, .exe, etc.
When a virtual directory name ends with an executable extension (such as .com, .exe, .dll, or .sh), the files in this virtual directory cannot be viewed with a Web browser. For more info, see here.
One option you have is to simply replace . with an underscore _ for personal pages. So your example above would be: http://www.mysite/user/example#gmail_com
I have a big solution that contains a lot of .aspx file, basically it's a big sln file for my whole server
I wanted to add a website in my IIS server that contains inside a child directory within the root site folder, for example:
my-tools.com physical path is D:/MyWeb <-- Working well
I added a secondary sites, with no relation to the upper site called mysite which is like that:
mysite.my-tools.com which its path it D:/MyWeb/MySite/
If I try to reach mysite.my-tools.com/M_Index.aspx file it give me an error tells me it's not found, however, when I try to view a .jps file from the same directory (e.g mysite.my-tools.com/test.jpg) it returns just find.
it's important to tell that all the pages share the same solution, what do I do here and why it is not working? can anyone tell me?
thanks a lot
having the folder separated like you do is a step in the right direction. next step is to configure IIS to point to that separate folder. then you would need to create a DNS entry for your sub-domain at your DNS host. "subdomain.domain.com". You would be creating a new site, so you could use the same IP address, as long as you add the proper host headers for each site.
I have a website with several subdomains that direct the user into a subfolder on my site. Inside each subfolder is a Default.aspx file which does some processing and then redirects the user to "../Default.aspx".
This works fine if you type the full URL to that page. If you try to access it through the subdomain, the ".." parent is not being parsed correctly, and just concatenates the subfolder path into the main path and I get a page not found.
The root path of my application is www.domain.com/root.
The subdomain points to subdomain.domain.com/root/subfolder
When I navigate to subdomain.domain.com, I get this error:
"404 - /root/subfolder/root/Default.aspx not found"
All I want is for subdomain.domain.com to redirect the user up one folder level to www.domain.com/root/Default.aspx
Can anyone help? Is this a feature/restriction of using a shared hosting provider - the subdomains are restricted to the folder where they are pointed?
Your description is a bit confusing, since you mix local paths and URLs together. Am I right that you are trying to do: Page at subdomain.domain.com/root/subfolder/Default.aspx redirects to www.domain.com/root/Default.aspx?
That means you want to do 2 things:
Redirect from sub-domain subdomain to sub-domain www, and
Navigate to a file one folder up.
Both things you can do in a single HTTP redirect. For this, use the Response.Redirect method, and make sure that in the URL you use the www sub-domain, and the correct absolute path to the page you want to show.
Response.Redirect("http://www.domain.com/root/Default.aspx");
Update
Or, redirect to a URL relative to the current page, in the same domain.
Response.Redirect( Page.ResolveClientUrl( "../Default.aspx" ) );
Update 2
Or, use the Host HTTP header to distinguish on subdomains and switch programatically in your shared codebase.
The answer is to point all the subdomains to the same folder (the main code base) and then in the Master file, switch based on the http header. If they are coming in from partner1.domain.com, use css1 - if they are from partner2.domain.com, use css2, etc.
This allows me to use relative paths throughout the code AND preserve the subdomain in the browser's URL bar.
One caveat - if you are testing in multiple environments (I have a DEV and a TST) you need some code to detect which environment you are in and operate a little differently, since the http header host would show something like "localhost:51510". For me, those subdomains only exist in my Production environment.
Credit to bgever - thanks!
Hopefully I can explain completely providing real info
To start with then we have a LinkButton whose text is actually an image tag.
The image it links to is a Png and resides in a folder in the web directory. This is IIS V6 and win Server 2003.
The path is http://webaddress/Admin/Images/image.png
Admin is a virtual directory configured in IIS.
The above url doesn't work but if you change it to http://webaddress/admin/Images/image.png (lowers case 'a') then the image is served, change it back to 'A' and it takes you to login, you log in and it loops back to log in. change to 'a' and voila the image is served. Weirdly this problem doesn't always occur and I have hunted for a resolution for days to no avail. Any ideas?
Thanks
As requested this is the complete link button
<asp:LinkButton ID="lnkCommitAll" runat="server" CausesValidation="false"><asp:Image ID="imgCommitAll" runat="server" ImageUrl="~/Images/Grid/confirm_16.png" AlternateText="Commit All Changes" /> Commit All</asp:LinkButton>
Could you post the whole LinkButton tag?
If Admin is a virtual directory then your image url should be like ~/Images/image.png
If so, do you have your virtual directory placed under the root with also a map called admin? In this case, try to rename it to "Admin", but don't forget to change the path in IIS for your virtual Directory.
I've had a similar problem before.
Hope this helps,
Arne
Say I have a directory structure like so:
/public
/public/company
/public/globals
/public/globals/images
/public/jobs
/public/jobs/it
... etc.
What I would like to do is to be able to configure an IIS Site to load from /public/company when visiting the domain root. I know I can change the site to /public/company, but if I do that, I can't seem to reference the /public/globals directory to obtain images, videos, and other items used across the site.
The other problem is accessing /public/jobs with a domain/jobs url... although I suppose virtual directories can help there, but then I would assume that I would still run into problems trying to access /public/globals for images and other things.
Any ideas? Am I not doing this right? I'm used to using Apache... obviously a very different environment...
Create a Default.aspx page in the root, and on that page, run this:
Response.Redirect("~/public/company/destination.aspx");
I seemed to have found the answer. I set the default path of the Site to /public/company, and created a Virtual Directory called "globals" that points to /public/globals. Now I can reference images via the Virtual Directory like so:
<img src="/globals/images/awesome.png" />
I suppose I just need to create virtual directories for everything under the sun for the rest of the site then.