Windows hosting issues

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
Hello people, I typically work with Linux hosting and PHP, but was asked to move an ASP-based site. So I set up a Windows hosting account, copied over all the files from FTP and pointed the domains to our hosting. Now, visiting the site just displays a directory listing. I've enabled URL rewriting in the web hosting control panel, but no effect.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
I'm honestly not sure. This hosting has an option for .htaccess (Linux-style) URL rewriting, which I tried, but no effect. I assumed Windows hosting would support IIS as default? I think you're right that the default page is the problem, but I don't know what to set it as. I have no index.anything in the root, just three files. I think one was called General.asax (or maybe Global.asax), then web.config and something else .config.

The bit in the web hosting control panel where I set it just has a large text area where you add filenames in order of priority to search for as the default page. No paths though. The site does contain an Index.aspx, but it's not in the root.
 

Sunius

Distinguished
Dec 19, 2010
390
0
19,060
Yes, the web hosting control panel place with priority list is what I meant. You should add the name of the file that you want as front page in Default Page list and make it the highest priority. It should work.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
That's what I mean - I don't have a clue what file that is. I didn't code the site (it's in ASP, which I don't do). I write PHP, and always have an index.php that assembles the page and pulls in what's needed based on the URL (i.e. index.php contains no actual page content). I'm assuming a typical ASP site works similarly, but not sure what the corresponding file would be. I tried the General.asax or Global.asax but got an error page back.
 

Sunius

Distinguished
Dec 19, 2010
390
0
19,060
.asax files aren't pages. Page files are .aspx ones. Since you do PHP programming I'm sure you know HTML. Just find the .aspx file which is the front page - I'm sure it shouldn't be too hard.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
That's what I thought, but it's definitely .asax. More than one of them too, so I don't think anyone made a typo. And I think you missed my point about my index.php pages - they're not homepage content like traditional HTML. It's a pure PHP page for assembling the output from header+content+footer. So I'm expecting to find a similar file in an ASP site.

I've found the homepage content file but firstly, I don't think that's what I need to be pointing to (I should surely be pointing to a file that routes page requests and pulls in assets?) and secondly, that index.aspx (this one is .aspx) isn't located in the site root. Is it even possible to add paths to the hosting option that searches for default files? None of the existing entries contain a path - it seems to be purely the root that's searched.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
OK, so you reckon add the full path in the list of default pages?

EDIT: Sorry I misunderstood there, you're saying that isn't necessary. But when I added the entry, it didn't open the file, so it looks like it does either need full path or for the file to be located in the root. I'll try the full path tomorrow and post back the results. Thanks for helping out with this :)
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
No luck. /Views/Home/Index.aspx returns a 'path not correct'. Same with /public_html/... and same with /Views/Shared/Site.Master (which is that central file I was looking for). Adding those without the path has no effect, I still wind up at the directory listing. The developer is telling me the hosting needs MVC support, hosting is telling me they already have support (but won't give any suggestion or solution). Most helpful suggestions are coming from a forum user with no stock or involvement in the site!
 

randomizer

Distinguished


.htaccess is for the Apache web server. IIS uses web.config which has its own URL rewrite rule format (it also specifies many other things). If your hosting provider makes lots of references to .htaccess then chances are they are running Apache which won't serve an ASP.NET application by default.



It should, because there's little reason to run Windows hosting (which usually costs more than Linux hosting) unless you need IIS. Really budget hosting may not though.



You don't navigate to specific files in an ASP.NET MVC application (well, it doesn't appear that way in a browser anyway), you navigate to "actions" which piece together a page on the server using one of more files and then send a HTML result to the browser. The actual file/directory structure is irrelevant to the client (except for static content like images). By default the home page would be yourdomain.com/Home/Index, but just going to yourdomain.com should refer to the same thing if routing is set up properly.

Of course you still need to be sure that you are running IIS or Apache that is configured to serve an ASP.NET MVC application. Otherwise they're all just text files.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
Thanks for your response. The hosting I'm using offers hybrid Windows/Linux hosting (however that works). Don't worry though - I'm not using that. They do have the option for .htaccess though and enabling it creates an .htaccess file in the root (outside of and same level as public_html). I've disabled that though.

The hosting has told me default docs don't matter for this, while the developer told me I should have one (though I'm pretty sure now they meant to say "shouldn't"). So I've removed my entry from the default docs list, enabled 'wildcard mapping to ASP .NET' and set a dedicated application pool for the site. Result now is an error page:

Server Error in '/' Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

Developer told me I'd just upload the files and it'll just work. :pfff:
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
OK renamed back to .asax :) Hosting is now telling me:

I think I see what's missing. Can you send over a copy of the database in .bak format please? The connection string is pointing to an SQL Express instance at the moment which was probably set up on the developer's PC.

But developer is an unbelievable d1ck and impossible to get responses from. I had wondered about database, but wasn't supplied with one. Hopefully I'll get a reply from them today.
 

randomizer

Distinguished
If you change:

Code:
<customErrors mode="Off"/>

to:

Code:
<customErrors mode="On"/>

You will probably see what's actually causing the site to blow up. That's likely what the hosting guys did to discover the DB issue. Don't leave it set to "On" for production though, as it will spit out lots of information that you don't really want public.

Certainly if the site uses a DB you'll need one though.