.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Null action id returns System.NullReferenceException

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net
 

This is what I'm trying to run:


If ControllerContext.RouteData.Values.Count = 0 Then
    ViewData("subdata") = ""
Else
    ViewData("subdata") = ControllerContext.RouteData.Values("id").ToString
End If



When I browse to www.mysite.com/mycontroller/myaction/myid, everything works ok. But visiting www.mysite.com/mycontroller/myaction produces:


Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceE


View Complete Post


More Related Resource Links

Downloading a document from a sharepoint site to local file system, copy web service returns null

  
Hi Guys,
               I am trying to get this done for the last 2 days and I am still banging my head to the wall.
All I need to do is to download files from my sharepoint site library that uses integrated windows authentication. I was using copy webservice : getItem method to accomplish this.

CopyService.GetItem(copySource, out myFieldInfoArray, out myByteArray);

Problem : myByteArray is always returned as NULL

Note: I have tried the same with another site that uses forms authentication but the result was the same (NULL !!)


This is my code:

CopyService.

Copy copy = new CopyService.Copy();

 

Linq to SQL returns null for DateTime fields.

  

I have a linq to sql entity class in which I declared some DateTime fileds like this:

[Column(DbType = "smalldatetime")]
public DateTime? StartDate { get; set; }


And this is how I fetch data form repository:

return repository.Logs.OrderByDescending(l => l.LogID).FirstOrDefault();


All non DateTime fields are filled properly but all datetimes are null.

[Column(DbType = "smalldatetime")]

        public DateTime? StartDate { get; set; }



FormsAuthentication.SignOut() results in System.NullReferenceException

  

Hi. I am getting a "System.NullReferenceException" when I call 
FormsAuthentication.SignOut() from Session_End method in global.asax. 
Code is as follow:
void Session_End(object sender, EventArgs e) 
    {
        FormsAuthentication.SignOut();

System.NullReferenceException: At Createtask Activity

  

HI,

I created  Approval Workflow application(.net3.0), it has successfully deployed at sharepoint server, but when executing  workflow at createTask activity, the following errror has occured.

System.NullReferenceException: Object reference not set to an instance of an object.     at BasicApprovalWorkflow.Workflow2.createApprovalTask_MethodInvoking(Object sender, EventArgs e)

below is the code :

private

 

void createApprovalTask_MethodInvoking(object sender, EventArgs e)

{

 

BuildManager.GetType returns null until application pool recycles

  
Our application uses the Enterprise Library's PropertyProxyValidator class to validate user input (v4.1 - Oct 2008).  On occassion, the code will raise an exception saying the source type cannot be found.  This error persists until the application pools recycle at night, at which point everything works again.  It tends to only affect one of the web front ends at a time (there are two). I tracked down where the exception was being raised, and this is the section of code:Type IValidationIntegrationProxy.ValidatedType { get { if (string.IsNullOrEmpty(this.sourceTypeName)) { throw new InvalidOperationException(Resources.ExceptionNullSourceTypeName); } Type validatedType = BuildManager.GetType(this.SourceTypeName, false, false); if (validatedType == null) { throw new InvalidOperationException( string.Format(CultureInfo.CurrentUICulture, Resources.ExceptionInvalidSourceTypeName, this.sourceTypeName)); } return validatedType; } } (As you can see, the value for this.SourceTypeName is shown in the exception and I've checked that it matches exactly.) We have never been able to reproduce this exception and at this point don't have any ideas left as far as causes.  For a while, my suspicion was that it was related to the Temporary ASP.NET Files folder.  The last

Registry OpenSubKey returns null

  
Hi,It seemed to be the right place to post to.My problem is that when I try to read registry key, I get null value, even if it exists (regedit shows it exists).Application is windows service with Log On As Local System and registry key im trying to read is in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSIDOn my development machine (x64 win7) it works fine. But in live server (x64 windows server 2008 r2) I get NULL. These operating systems should have similar policies or does Local System on server 2008 have any restrictions i should know about?RegardsMax

System.NullReferenceException: Object reference not set to an instance of an object

  
        BVWS.Vardering oWS = new BVWS.Vardering();        BVWS.strucBPVardering oSvar1 = new BVWS.strucBPVardering();        BVWS.StrucPaket oPaket = new BVWS.StrucPaket();                 if (Page.IsPostBack)        {             oSvar1 = oWS.BpVardering("", "", regnummer.Text, "2000", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", DropDownList1.SelectedValue);      tdCHK1.Visible = false;                  try            {                if (oSvar1.rubst01.Length > 0)                {                   

RS2008 Export to PDF failed with System.NullReferenceException

  
Hi, I have a rdl file from RS2005. I can generate the report, export it to PDF without any problem. But with the same rdl file in RS2008 and same data, when I export it to PDF. I got the following error in the ReportServerService log file. reportrendering!ReportServer_0-6!135c!08/13/2009-10:08:14:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report., ;  Info: Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report. ---> Microsoft.ReportingServices.OnDemandReportRendering.ReportRenderingException: An error occurred during rendering of the report. ---> System.NullReferenceException: Object reference not set to an instance of an object.    at Microsoft.ReportingServices.Rendering.HPBProcessing.Paragraph.get_SpaceBefore()    at Microsoft.ReportingServices.Rendering.RichText.LineBreaker.FlowParagraph(Paragraph paragraph, Directions direction, IntPtr hdc, Single dpiX, FontCache fontCache, FlowContext flowContext, Boolean keepLines, SizeF flowContextSize, Int32& contentOffset)    at Microsoft.ReportingServices.Rendering.RichText.LineBreaker.Flow(TextBox textBox, IntPtr hdc, Single dpiX, FontCache fontCache, FlowContext flowContext, Boolean keepLines, Single& height)    at Microsoft.ReportingServices.Re

FindControl returns null

  
I am trying to fetch two Labels within a Repeater element to attach data to; which Label is assigned which Data Field depends on the result of a Radio Button List, hence why I need to fetch them in the code behind. This is the ASP.NET code: <asp:View ID="vwSportType" runat="server"> <table> <tr> <td rowspan="2"> <span class="boldtext">Select type of sport:</span><br /><br /> <asp:ListBox ID="lbType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="lbType_OnSelectedIndexChanged" Height="300px" Width="12em"> </asp:ListBox> </td> <td width="70%"> <span class="boldtext">Show by: <asp:RadioButtonList ID="rbSportType" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Text="Date, Sport" Selected="True" Value="0"></asp:ListItem> <asp:ListItem Text="Sport,

System.NullReferenceException: Object reference not set to an instance of an object.

  
I am working on a Windows 7 professional machine, 64bit,  to learn SQL server 2008.   i'm working with the microsoft sql server 2008 step by step book and i'm stck on configuring email notificaions. i've already goe through the GUI to configure my email settings. however, sql server agent is disabled. when i try to start the service i get the following error: Unhandled exception has occurred in your application....... Object reference not set to an instance of an object. Here are the details of the error message: See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. Server stack trace:    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.FindObjectExplorerFrame()    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.GetObjectExplorer(Boolean activateWindow)    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ShowError(Exception e)    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.Service.Start()    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, In

Why this returns null

  
hi friends, i have a table AppUser.UsersUserRole that has the following structure: idx auto ur_id int -- user role id id int    -- user id that has the following data:  From Drop Box  when i ran query to returns a csv: declare @csv nvarchar(max) select @csv = @csv + coalesce( convert(nvarchar(max), ur_id) + ',','' ) from AppUser.UsersUserRoles where id = 28 select @csv it returns:  From Drop Box  but there are three records for 28, why it displays null, how do i fix this? thanks

SCOPE_IDENTITY() returns null after paramerized INSERT

  

I have a very simple database, without any triggers at this point. One of my tbales has a auto increment key (IDENTITY field). As the record has a string attribute, which valeu is received from the user, I insert a new records with a parametized INSERT statement. After insertion I try to fetch the new record's ID with the sttament SELECT SCOPE_IDENTITY(), but ti return null - while SELECT @IDENTITY and SELECT IDENT_CURRENT returns the valid values.

Moreover, if - for testing purposes - I execute the same insert without parameters, (i.e. providing the string value directly in the INSERT statement), then even SCOPE_IDENTITY() returns the correct value.

I didn't find any reference in the documentation regarding such restriction. Is is a known bug or the result of some misunderstading?


HyperlinkField.DataNavigateUrlFields gets me System.NullReferenceException:

  

Hi All,

I am having an issue with something that seems to be very simple yet it is not. 

I have a HyperlinkField and I am trying to tell it what the Link is by doing this statement: 

CustomerNo.DataNavigateUrlFields = Paramater;


Paramater is defined as: string[] Paramater = new string[10]; and assigned Paramater[0] = "cus_link";


Everytime I get this error: 

ERROR: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.UI.WebControls.HyperLinkField.OnDataBindField(Object sender, EventArgs e) at System.Web.UI.Control.OnDataBinding(EventArgs e) at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBind() at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBind() at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBind() at System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, T

Exception Details: System.NullReferenceException: Object reference not set to an instance of an obje

  

Hi, i have a Problem, i made a ASP.NET Page with VS2010 and now i want to run it on a iis6 (windows server 2003) and i get the message:

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

 

Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

Stack Trace:

 

[NullReferenceException: Object reference not set to an instance of an object.]

   Bestellung.Bestellung.ImageButton1_Click(Object sender, ImageClickEventArgs e) in D:\foo.aspx.cs:71

   System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115

   System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +120

   System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13

   System.Web.UI.Page.RaisePostBa

System.NullReferenceException: Object reference not set to an instance of an object.

  

I have developed an application with asp.net 2.0 and SQL Server 2005. It is working fine on my local PC without any error and exceptions.

When i moved the application to server, i m getting the following runtime exception.

User needs to login initially to enter application. Once they submit login the following exception occur.

System.NullReferenceException: Object reference not set to an instance of an object.

Here is my error code:

                          Dim dbdata As dataconnection = New dataconnection
Line 54:             Dim dr As SqlDataReader = dbdata.finduser(user_id, user_password)
Line 55:             If dr.HasRows Then   ' error here
Line 56:                 Return True
Line 57:             Else


 Please help me ASAP .  No such exception, when i run on local PC.


FeatureReceiver error "System.ArgumentNullException: Value cannot be null."

  
System.ArgumentNullException: Value cannot be null. 
Parameter name: type 
  at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
  at System.Activator.CreateInstance(Type type) 
  at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject() 

 

This come from my feature installer class for all 4 methods

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace PlantCML.GetAlertsJob {
 class GetAlertsJobInstaller : SPFeatureReceiver {
   const string GET_ALERTS_JOB_NAME = "GetAlerts";

  public override void FeatureInstalled (SPFeatureReceiverProperties properties) {
  }


  public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
  {
  }


  public override 

List does not exist -- AutoStart Workflow: System.NullReferenceException:

  

I have been in a discussion on the MSDN forums concerning a site with which I am having considerable issues.  (http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/0feaf4c7-77cd-46c6-b3cd-4d18c69b18c3)    There is one issue that keeps cropping on one of the pages on that site.  The page is a customization of the EditForm.aspx which is being used to edit folders. We call it EditFolderForm.  Like the EditForm it uses a DataFormWebPart.  It also has a SharePoint:SaveButton  and a SharePoint:GoBackButton.  The Listid on the page has been confirmed to be the correct ListID.  Clicking the SaveButton causes the following two errors:

List does not exist  The page you selected contains a list that does not exist.

and then

AutoStart Workflow: System.NullReferenceException: Object reference not set to an instance of an object.

I have found references that mentioned getting these messages for custom made workflows that are built on Designer.  However the workflow being called is a built in SharePoint Workflow so that none of the suggested fixes will work.  (Also it seems that the workflows that cause the issue seem to be sending

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend