PDA

View Full Version : Subdomain redirection


JustJo
01-28-2009, 01:00 AM
I hope someone can help me. I am just learning how to use ASP with Visual Studio and I am having a lot of trouble trying to make a subdomain work. Until this day, aslong as a subdomain is added correctly into a server it works without anything to do from the user part (subdomain.domain.net)but with discountasp the story is different: I am told that in order for it to work I have to add a scriptto my default page, which can contain nothing but the script, and it's the script that will call the requested URL by any user.

This is thescrip:

The following is a sample script that you can use to redirect a subdomain. You will need to place it as default document on your document root.

<%
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then
Response.Redirect("/subdomain1")
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.YourHostedDomainName.com") ) > 0 Then
Response.Redirect("/subdomain2")
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.YourHostedDomainName.com") ) > 0 Then
Response.Redirect("/subdomain3/home.asp")
End If
%>

When I asked for help they told me they don't offer any help with scripts and I should try the forum.

The original site (http://iphix.net) is at a different server right now but I have to change because they don't offer ASP hosting and it's a must that I make the transition to asp.net, and I do have the subdomain (http://gl.iphix.net) working without any problem (very lousy design).

I have copied everything to the new server and thetest website is at http://iphixnet000.web703.discountasp.net/The test subdomain is at http://iphixnet000.web703.discountasp.net/gl/The subdomain (when it finally goes online) should be gl.iphix.net but I can't make the change from one server to the other until I am totally sure it will work because most users call the subdomain URL in order to access it and it's quite busy

Iknow you guys are experts and I am just trying to design and makethis website work and put it online, so I need someone's help!!

My questions are:

Should the default page be default.aspx or can it be index.aspx?
Can the extension be .aspx or it must be .asp?
Does it go on the <head> part of the page?
How should I enclose the script? Would <script type="text/C#"></script> work?


I am not sure if I make any sense, I would really appreciate any help I can get.


Thanks a lot

bruce
01-29-2009, 07:30 AM
* Should the default page be default.aspx or can it be index.aspx?

Yes. It depends on what you set the default document to be. By default, both should work/

* Can the extension be .aspx or it must be .asp?

I think both should work

* Does it go on the <head> part of the page?

Not sure i understand this q!!

* How should I enclose the script? Would <script type='text/C#'></script> work?

No. use <% %>

Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

JustJo
01-29-2009, 07:39 AM
Thank you so much for replying, Bruce. My question about the <head> is because there is also the [b], or am I on the wrong page?

Is there a way I can try the script before I change servers?My sitepage is at http://iphixnet000.web703.discountasp.net, how could I test it?

Thanks!

calloncampbell
03-06-2009, 01:31 PM
I'm having similar issues. I'm new to ASP.NET and what I want to do is as follows. Can someone let me know if this is the write course of action. Thanks

Lets say my domain is www.domain.com and I have a simple asp.net 3.5 website in the root. I also have another website in a sub folder called "folder2".

what I want is instead of going to www.mydomain.com/folder2 to access this website, I want to instead go to folder2.mydomain.com

How do I do this? In C# context.

Thanks
Callon