View Full Version : aspx page won't work on server
gib65
09-19-2012, 02:57 AM
Hello,
I just uploaded the latest version of my website here: http://www.shahspace.com/nuts_and_bolts/home.html. I'm having trouble getting the contact page to work. Unlike the other links, if you click on it, it doesn't do anything.
Running IIS 7 on my local machine, it works fine. It's an aspx page with some C# script.
Is it possible that my server doesn't know how to run C# script? I know it can run VB script. The server runs IIS 6. Is there any way to tell what kinds of scripts it can run and what kinds it can't? If it can't run C# script, how can I enable it so that it can?
djr33
09-19-2012, 03:58 AM
There certainly must be a way to tell. I don't know what it is, though.
There are also two possibilities: 1) your server doesn't have C# installed; 2) your server doesn't have C# enabled.
Also, 3) Your server doesn't recognize that file as a "C#" type file.
With PHP, here's how it works. There's probably something parallel for C#.
You must have PHP installed and running. Then you must end all pages with a ".php" extension for the server to know to process them as PHP. This isn't technically required, though. You can also do it with .htaccess (or I think php.ini) settings so that a .html file is also parsed this way. But by default it doesn't happen because that would waste server resources processing all HTML pages as PHP (extraneously, most of the time).
For PHP, there's an easy way to tell. Create a new page called "test.php" with just this code on it:
<?php phpinfo(); ?>The phpinfo() function will always work if PHP is running and will simultaneously give you all of the details about the configuration (version number, optional features, server paths, etc.).
Do a search to see if there's something similar for C#. I'm not sure how C# works on a webserver, though, so you'll have to work that out yourself. (I don't think any of the regulars here use C# for web design either, but of course you're welcome to see if you get a reply, I just don't think it's very likely.)
And if that doesn't work, just do the most basic C# thing you can think of to see if C# is enabled/working. For example (in PHP again):
<?php echo 'Hello World!'; ?>If that works, C# (well, PHP) is working and you then know it's your script that isn't working rather than C# as a whole.
If I had to make a guess, I'd say that I'm surprised to hear about C# on a webserver, so it's probably not installed. I don't do much with Windows servers (or C#), but I think I would have at least heard of this if it's a default on most servers.
I hope that helps! Sorry for the indirect information.
gib65
09-20-2012, 04:11 AM
Thanks djr,
I did a bit of digging around in IIS 6 and I found that if I update the version of ASP.NET to the latest one (4.0.30319 in my case), the page starts working.
I originally wanted to ask a question about how postback works on ASPX pages, but I needed to make the page accessable on a public server first. That obviously didn't work at first, but now that it is working (and others can visit it and see the problem for themselves), I'd like to ask my original question:
If you click on the "contact" link, you be taken to a form that you can fill out. You can go ahead fill it out and click submit. An email will be sent to me.
What I'd like you to notice is that when you click submit, the entire window gets taken over by the page in the div below the menu. This must have something to do with the way postback works on aspx pages.
You should note that the way I linking the aspx page into the bottom div (Where the form shows up) is through some jquery. I have this on home.html:
...
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js">
</script>
...
<script type="text/javascript">
...
function loadContent(elementSelector, sourceURL)
{
$(elementSelector).load(sourceURL);
}
</script>
...
<div id="contact" class="menu"
onmouseover="italicize('contact'); return false;"
onmouseout="unitalicize('contact'); return false;">
<a href="javascript:loadContent('#content', 'contact.aspx');">
Contact
</a>
</div>
So when you click the "contact" link, the loadContent javascript function gets called, which loads contact.aspx into the "content" div.
How can I program it so that the refresh of contact.aspx at postback does not take over the entire browser window and instead stays confined to the div it was originally in?
djr33
09-20-2012, 04:47 AM
I can't really help you with the ASP either, sorry. I just do PHP.
But if I'm understanding you correctly, then there are three options:
1) Reload the page. This is the main way of getting new content.
2) Use Ajax (a method in Javascript) to request new content in the background, then load that via JS.
3) Use ActiveX and ASP together, which will only work in Internet Explorer. It's basically like how (2) would work, but only works in IE and might be a little more coherent as a system if you like working with ASP and ActiveX. I wouldn't recommend it though because of the limitation of just working in IE.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.