Geo
Geo

Reputation: 3200

Error when uploading a .aspx file on the server

I am getting a runtime error when i upload an .aspx file on my server. I uploaded files before of the same format and they were working fine so my server does support this service. Also, the application is working fine on my local server.

This is the error:
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 tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".


And this is my code:

<%@ Page Language="C#" %> <%@ import Namespace="System.IO" %> <%@ import Namespace="System" %> <%@ import

Namespace="System.Collections.Generic" %> <%@ import Namespace="System.Linq" %> <%@ import Namespace="System.Web" %> <%@ import Namespace="System.Web.UI" %> <%@ import Namespace="System.Web.UI.WebControls" %>

public void Button1_Click(object sender, EventArgs e)
{
    //This a program that calculates your mortgage payments

    //Variables used 
    double p;
    double m = 0;
    double rate = 0;
    int years = 0;
    int ny = 0;
    bool result = false;

     rate = DropDownList2.SelectedIndex;    //Here we get the values from the comboBox1 and assign it to the variable "rate"


    //The following IF statements get the value from the radio buttons and assign it to the variable "years"

    if (RadioButtonList2.SelectedIndex == 0)
    {
        years = 15;

    }
    if (RadioButtonList2.SelectedIndex == 1)
    {
        years = 30;

    }
    if (RadioButtonList2.SelectedIndex == 2 && TextBox5.Text != null)
    {
        if (int.TryParse(TextBox4.Text, out ny))
        {
            years = ny;
        }

    }


    //A simple if statement to check if the user filled out all values necessary for the calculation.
    //if any of the values where wrong or missing the program prompts the user to check his/her input again

    if (years != 0 && rate != 0 && double.TryParse(TextBox4.Text, out p))
    {
        m = (p * rate / 1200.0) / (1 - Math.Pow((1.0 + rate / 1200.0), -12.0 * years));
        result = true;


    }
    else
    {
        TextBox6.Text = "Please fill all boxes!";
    }


    //If all of the above steps checks true then the payment amount is displayed on textBox3
    if (result == true)
    {
        TextBox6.Text = m + "";
        StreamWriter sw = File.AppendText("d:/log_file.txt");
        sw.WriteLine(DateTime.Now + "\nAmount: " + m + "");
        sw.WriteLine();
        sw.Close();
    }

}

public void Button2_Click(object sender, EventArgs e)
{
    TextBox4.Text = null;
    TextBox5.Text = null;
    TextBox6.Text = null;
    RadioButtonList2.SelectedIndex = 0;
}
public void Page_Load(object sender, EventArgs e)
{

} </script>

  <script src="css_browser_selector.js" type="text/javascript"></script>

Geo Nicolaides | Monthly Payments

$(document).ready(function () { $('#page_effect').fadeIn(500); });

George Nicolaides

IT-330

<div class="footer">

  <div id="nav">

      <div class="navlist1">

          <ul> <li> <a class="navlist" href="index.html">Home</a> </li></ul>

      </div>

     <div class="navlist1">

          <ul> <li><a class="active" href="projects.html" >Projects</a></li> </ul>

      </div>



        <div class="navlist1">

          <ul> <li><a class="navlist" href="view-log.aspx" >Log Files</a></li> </ul>

      </div>          



  </div>



</div> </div>
<div class="wrapper2">            





<div class="content">

<div id="page_effect" style="display:none;"> 




    <asp:Label ID="Label6" runat="server" Text="Years of payments:" ForeColor="White"></asp:Label>
    <asp:RadioButtonList ID="RadioButtonList2" runat="server" style="margin-left:0px; color:White;">
        <asp:ListItem>15</asp:ListItem>
        <asp:ListItem>30</asp:ListItem>
        <asp:ListItem>Other</asp:ListItem>
    </asp:RadioButtonList>
    <asp:TextBox ID="TextBox5" runat="server" style="margin-left:0px" Width="47px"></asp:TextBox>
<br />
    <asp:Label ID="Label7" runat="server" Text="Interest Rate" ForeColor="White"></asp:Label>    <br />
    <asp:DropDownList ID="DropDownList2" runat="server" Height="23px" 
        style="margin-left: 0px">
        <asp:ListItem Selected="True">Rate</asp:ListItem>
        <asp:ListItem>3.0</asp:ListItem>
        <asp:ListItem>3.5</asp:ListItem>
        <asp:ListItem>4.0</asp:ListItem>
        <asp:ListItem>4.5</asp:ListItem>
        <asp:ListItem>5.0</asp:ListItem>
        <asp:ListItem>5.5</asp:ListItem>
        <asp:ListItem>6.0</asp:ListItem>
    </asp:DropDownList>
  <br /> <br />

    <asp:Button ID="Button2" runat="server" style="margin-left: 0px" 
        Text="Calculate" onclick="Button1_Click" ForeColor="Black" 
    Height="37px" Width="119px"  />

 <br /> <br />

    <asp:Label ID="Label8" runat="server" Text="Monthly Payment:" ForeColor="White"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="TextBox6" runat="server" style="margin-left: 0px" 
        AutoPostBack="True" BackColor="White" Columns="50" ReadOnly="True" 
        ViewStateMode="Enabled" Width="142px"></asp:TextBox>
<br />
  <br />
    <asp:Button ID="Button1" runat="server" style="margin-left: 0px" 
        Text="Reset" onclick="Button2_Click" ForeColor="Black" 
    Height="37px" Width="119px"  />

 <br /> <br />

    <div class="largespacebelow">


  </div>            



  </div>

  </div>

  </div>



  <div class="push2">          

Upvotes: 0

Views: 847

Answers (2)

Geo
Geo

Reputation: 3200

I had a wrong Namespace on the top of my site.

Upvotes: 0

Norm MacLennan
Norm MacLennan

Reputation: 451

Your first step should be to get the 'real' error. If you have local/GUI access to the server, log in and try to browse to the page at localhost.

Otherwise, you should edit your web.config to set the customerrors mode to off so you can see the detailed error report remotely. Note: Do not do this if you are worried about security implications, but I'm assuming this isn't any sort of live high-traffic public website.

Here is the page about the customerrors web.config element, but basically you just flip the "mode" bit to "off". That should give you a lot more information to work with.

One thing I notice after a once-over of your code (and this may just be because the formatting is all kinds of screwed up), but I don't see an opening <script> tag before your button1_click method. You should also consider moving all of the C# to a code-behind file to separate the logic and design and make everything easier to read and maintain.

Upvotes: 1

Related Questions