Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi everybody

i am trying to upload an asp.net website to another computer that works as webserver.
i dont know how to do it?
i just copy the project file to inetpub folder and set my connectionstring too.
but i face with this error.

[NullReferenceException: Object reference not set to an instance of an object.] NovinMedia.Data.DbObject..ctor() in F:\Dr Websites\tehrancohort\Tcohort\Tcohort\Classes\DbObject.cs:32 DataLayer.Users.CheckLogin(String Username, String Password) in F:\Dr Websites\tehrancohort\Tcohort\Tcohort\Classes\DataLayer\Users.cs:55 Tcohort.Login.cvLogin_ServerValidate(Object source, ServerValidateEventArgs args) in F:\Dr Websites\tehrancohort\Tcohort\Tcohort\Login.aspx.cs:20 System.Web.UI.WebControls.CustomValidator.OnServerValidate(String value) +172 System.Web.UI.WebControls.BaseValidator.Validate() +102 System.Web.UI.Page.Validate() +288 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +115 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3803 


the addresses in error are the addresses that locate on my local pc not inetpub folder!

please help me,i am new.
Posted
Updated 26-Feb-15 5:23am
v2
Comments
ZurdoDev 26-Feb-15 10:57am    
Sounds like you have it configured incorrectly in IIS.
abhijeetgupta1988 26-Feb-15 11:03am    
Check the line #20 in Login.aspx.cs with the same Database as of your server & with same parameters/textbox values.

And file path which gets displayed in error is of path where dlls were generated by the compiler/visual studio i.e. bin folder .

You did not show where the exception with the message "Object reference not set to an instance of an object" is thrown.

Not to worry. This is one of the very easiest cases to detect and fix. It simply means that some member/variable of some reference type is dereferenced by using and of its instance (non-static) members, which requires this member/variable to be non-null, but in fact it appears to be null. Simply execute it under debugger, it will stop the execution where the exception is thrown. Put a break point on that line, restart the application and come to this point again. Evaluate all references involved in next line and see which one is null while it needs to be not null. After you figure this out, fix the code: either make sure the member/variable is properly initialized to a non-null reference, or check it for null and, in case of null, do something else.

Please see also: want to display next record on button click. but got an error in if condition of next record function "object reference not set to an instance of an object"[^].

Sometimes, you cannot do it under debugger, by one or another reason. One really nasty case is when the problem is only manifested if software is built when debug information is not available. In this case, you have to use the harder way. First, you need to make sure that you never block propagation of exceptions by handling them silently (this is a crime of developers against themselves, yet very usual). The you need to catch absolutely all exceptions on the very top stack frame of each thread. You can do it if you handle the exceptions of the type System.Exception. In the handler, you need to log all the exception information, especially the System.Exception.StackTrace:
http://msdn.microsoft.com/en-us/library/system.exception.aspx[^],
http://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx[^].

The stack trace is just a string showing the full path of exception propagation from the throw statement to the handler. By reading it, you can always find ends. For logging, it's the best (in most cases) to use the class System.Diagnostics.EventLog:
http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx[^].

Good luck,
—SA
 
Share this answer
 
Comments
Abhinav S 26-Feb-15 11:58am    
5!
Sergey Alexandrovich Kryukov 26-Feb-15 11:59am    
Thank you, Abhinav.
—SA
Debugging, if possible, should help you resolve the problem.
You may be trying to access a property of an object that itself is null.
 
Share this answer
 
Hi guys,

thanke you for your solutions.

but i found the error resource at connectionstring name.i have written it wrong ,just in capslock!!!!!!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900