Anyone have an idea why my form works perfectly on my local computer but when I upload it and run it remotely I get a server error...? I'm a web design beginner and have lots of books but I did everything perfectly and can't figure out what the problem could
be. What things should I check? Should I post the domain name so you can see? Any suggestions are appreciated [:^)]
Need to know what kind of error are you getting. If it runs ok locally, then it might have to do something with the path, security, permissions etc. Post the error here.
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 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".
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 configuration tag to point to a custom error page URL.
Do you have physical access to the server. If yes, then run the page from server's machine, so that you can view the error. If you do not have access to server, then do you do error logging? If yes, then check your error logs to see what kind of error
was thrown. If none of the above can be done, then you have to set the customerror mode to on (Which you should never do on production server) to get hold of the error. Sorry cannot help more.
I don't suppose you'd know how to accomplish that on Godaddy would you? This isn't the first asp.net problem I've had hosting with them. I filed a support ticket with them but I'm not getting my hopes up just yet. [8-)] Do you have any other hosting site
recommendations I can try while I'm waiting?
No sorry. But what you can do is write a file when exception occurs. Put this code in global.asax (if you don't have create one). All the exceptions will be propogated here.
Imports System.IO
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
' Log the error
Dim ex As Exception = Server.GetLastError().GetBaseException()
Dim msg As New StringBuilder()
With msg
.Append("MESSAGE: ")
.AppendLine(ex.Message)
.Append("SOURCE: ")
.AppendLine(ex.Source)
.Append("FROM: ")
.AppendLine(Request.Form.ToString())
.Append("QUERYSTRING: ")
.AppendLine(Request.QueryString().ToString())
.Append("TARGETSITE: ")
.AppendLine(ex.TargetSite.ToString())
.Append("STACKTRACE: ")
.Append(ex.StackTrace)
End With
' Create a text document
Dim path As String = "~/MyError.txt"
Dim sw As StreamWriter
' If it doesn't exist, create it
If File.Exists(Server.MapPath(path)) = False Then
' Create a file to write to.
sw = File.CreateText(path)
sw.Flush()
sw.Close()
End If
' Write it
sw = File.AppendText(path)
sw.WriteLine(msg.ToString())
sw.Flush()
sw.Close()
End Sub
Just give read/write/modify permission to this file, so that the log can be written. After you get the error, check this file for the error message.
I think you missed the Imports statement at the top of my code. File class resides in System.IO namespace.
To grant permissions you have right click on the file, go to security tab and give the appropriate permission to the identity that is going to write the file.
Ok. I made the error go away by changing file to io.file... the
Imports System.IO, when put after <script
runat="server"> gives the error 'Imports' statements must precede any declarations. When I put it after
<%@
Application Language="VB" %>, the error goes away but I still get the 'file' not defined error.
Also, after uploading the global.asax, I right clicked on it and it says the server does not support changing file permissions..... Now what? I'm totally stumped [:S]
cassiopia
Member
27 Points
133 Posts
Contact me (wizard) form working on local computer but not remotely...
Sep 09, 2007 04:47 PM|LINK
Anyone have an idea why my form works perfectly on my local computer but when I upload it and run it remotely I get a server error...? I'm a web design beginner and have lots of books but I did everything perfectly and can't figure out what the problem could be. What things should I check? Should I post the domain name so you can see? Any suggestions are appreciated [:^)]
codeasp
Star
14735 Points
2545 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 09, 2007 09:05 PM|LINK
Need to know what kind of error are you getting. If it runs ok locally, then it might have to do something with the path, security, permissions etc. Post the error here.
cassiopia
Member
27 Points
133 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 09, 2007 11:15 PM|LINK
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 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".
<!-- 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 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>
codeasp
Star
14735 Points
2545 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 09, 2007 11:57 PM|LINK
Do you have physical access to the server. If yes, then run the page from server's machine, so that you can view the error. If you do not have access to server, then do you do error logging? If yes, then check your error logs to see what kind of error was thrown. If none of the above can be done, then you have to set the customerror mode to on (Which you should never do on production server) to get hold of the error. Sorry cannot help more.
cassiopia
Member
27 Points
133 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 10, 2007 12:27 AM|LINK
I don't suppose you'd know how to accomplish that on Godaddy would you? This isn't the first asp.net problem I've had hosting with them. I filed a support ticket with them but I'm not getting my hopes up just yet. [8-)] Do you have any other hosting site recommendations I can try while I'm waiting?
codeasp
Star
14735 Points
2545 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 10, 2007 12:58 AM|LINK
No sorry. But what you can do is write a file when exception occurs. Put this code in global.asax (if you don't have create one). All the exceptions will be propogated here.
Imports System.IO Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when an unhandled error occurs ' Log the error Dim ex As Exception = Server.GetLastError().GetBaseException() Dim msg As New StringBuilder() With msg .Append("MESSAGE: ") .AppendLine(ex.Message) .Append("SOURCE: ") .AppendLine(ex.Source) .Append("FROM: ") .AppendLine(Request.Form.ToString()) .Append("QUERYSTRING: ") .AppendLine(Request.QueryString().ToString()) .Append("TARGETSITE: ") .AppendLine(ex.TargetSite.ToString()) .Append("STACKTRACE: ") .Append(ex.StackTrace) End With ' Create a text document Dim path As String = "~/MyError.txt" Dim sw As StreamWriter ' If it doesn't exist, create it If File.Exists(Server.MapPath(path)) = False Then ' Create a file to write to. sw = File.CreateText(path) sw.Flush() sw.Close() End If ' Write it sw = File.AppendText(path) sw.WriteLine(msg.ToString()) sw.Flush() sw.Close() End SubJust give read/write/modify permission to this file, so that the log can be written. After you get the error, check this file for the error message.cassiopia
Member
27 Points
133 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 10, 2007 01:17 AM|LINK
Getting Name 'File' is not declared message. I also needed to change streamwriter to IO.StreamWriter
How should I declare File? I'm also confused how I give read/write/modify permissions
I closely followed the video that shows how to build a contact me form but I wish he would have a video that covers errors...[:)]
Thanks for your patience, we'll eventually get to the bottom of this. lol
codeasp
Star
14735 Points
2545 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 10, 2007 01:41 AM|LINK
I think you missed the Imports statement at the top of my code. File class resides in System.IO namespace.
To grant permissions you have right click on the file, go to security tab and give the appropriate permission to the identity that is going to write the file.
cassiopia
Member
27 Points
133 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 10, 2007 02:41 AM|LINK
Ok. I made the error go away by changing file to io.file... the Imports System.IO, when put after <script runat="server"> gives the error 'Imports' statements must precede any declarations. When I put it after <%@ Application Language="VB" %>, the error goes away but I still get the 'file' not defined error.
Also, after uploading the global.asax, I right clicked on it and it says the server does not support changing file permissions..... Now what? I'm totally stumped [:S]
cassiopia
Member
27 Points
133 Posts
Re: Contact me (wizard) form working on local computer but not remotely...
Sep 10, 2007 04:24 AM|LINK
At this time, I'm going to try hosting the site on a different server. I'll get back in a day or 2 and let you know if that helped. Thanks [;)]