none
I have a weird question abount ASP .NET Page RRS feed

  • Question

  • Hi there,

    our source code of ASP .NET will be managed by using TFS. My ex-colleague had quitted the job and I take over his source code. Now I found a strange a problem is when I amend the source code and publish to our client environment. I got the error message. the following the message like this:

    Unhandled Execution Error
    Object reference not set to an instance of an object.
      at MCD.CCHS.OnlineForm.contactus.ContactUs.btnSubmit_Click(Object sender, EventArgs e) in p:\KenonSiu\McDonald\SourceSafe\XXXXXXXX\XXXXX\XXXXXXX\ContactUs.aspx.cs:line 171
      at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
      at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    BUT the path is wrong: p:\KenonSiu\McDonald\SourceSafe\XXXXXXXX\XXXXX\XXXXXXX\ContactUs.aspx

    Actually the physical path of program should be c:\XXXXXXXXX, but when we run the webpage, it always call the page located in the p:\KenonSiu\McDonald\SourceSafe\XXXXXXXX\XXXXX\XXXXXXX\ContactUs.aspx.cs

    so how should I sort it out.

    Thanks.


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    • Moved by CoolDadTx Tuesday, July 16, 2019 1:47 PM ASP.NET related
    Tuesday, July 16, 2019 7:27 AM

All replies

  • Unhandled Execution Error

    Object reference not set to an instance of an object.

    It means that an object was being referenced in code and it's a null valued object. The object is not in memory at the time code is execution that is referencing the object. 

    It's basic OOP 101 and it doesn't matter if it's Java or .NET, becuase it's the same principles.

    https://alfredjava.wordpress.com/2008/07/08/class-vs-object-vs-instance/

    You don't know what object is a null valued object in the code executing in the button event. If you ere capturing the stacktrace, it would probably point to the line of code that the exception was thrown on.

    You may have to get into some remote debugging with the ASP.NET Web application on the client's IIS using Visual Stuido debugger, if you cannot expose what line of code in the button's event is cuasing the exception.

    ASP.NET issues can be discussed at the ASP.NET forums, like the Web form forum.

    http://forums.asp.net/

    Tuesday, July 16, 2019 8:01 AM
  • Hi,

    I have found out the issue "Object reference not set to an instance of an object"

    BUT my question is actually my source code is in the C:\XXXXX; but the error message is P:\XXX\XXX\... . And all source code is managed by TFS.


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    Tuesday, July 16, 2019 11:46 AM
  • Hi,

    I have found out the issue "Object reference not set to an instance of an object"

    BUT my question is actually my source code is in the C:\XXXXX; but the error message is P:\XXX\XXX\... . And all source code is managed by TFS.


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    A TFS workspace that source code is downloaded to the machine is created on a per machine basis by the user/person/developer that uses the machine. TFS knows about the workspace as defined by the user. One user can use <C> on a machine while another user may use <D> on their machine, which does not contribute to any error the program may encounter. 

    You should take a tutorial on how to use TFS. 

    Tuesday, July 16, 2019 12:54 PM
  • To be honest, I don't think the answer is better for me. because generally speaking, we just download the source code from TFS, one asp .NET page will come with one .cs file and all of them will live in the same folder. it now my question is my .aspx locate in the local disk (C:\xxxxx\xxxxx) and my .cs file locates another disk or folder (D:\xxxxx\xxxxx). that's unreasonable. so I just want to know why it is like this.??

    but anyway I also thanks for your help.



    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.


    • Edited by Will .H Tuesday, July 16, 2019 1:08 PM
    Tuesday, July 16, 2019 1:07 PM
  • Hello,

    I curious why you don't code exclusively on your C#?

    Also what is on line 171 of ContactUs page?


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, July 16, 2019 1:44 PM
  • Please post questions related to ASP.NET in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, July 16, 2019 1:47 PM
  • Hi Kareninstructor,

    what is on line 171 of ContactUs page? 

    my .aspx file is in the P:\abcd disk, and .cs file is in the P:\efghij, and this is error message comes from .cs file --> it is weird to find if I publish to production or UAT environment, the error message always shows up. and it will tell you " ... p:\KenonSiu\McDonald\SourceSafe\XXXXXXXX\XXXXX\XXXXXXX\ContactUs.aspx.cs:line 171" 

    but there are no < disk P > on the UAT or Production... strange @@


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    Tuesday, July 16, 2019 2:31 PM
  • thanks for your reminder. I have moved the off-topic post to ASP .NET forum

    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    Tuesday, July 16, 2019 2:37 PM