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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Null reference message Custom Error page

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :ASP.Net
how come a Null session value that is called, doesn't get directed to the Custom Error Page?

View Complete Post

More Related Resource Links

Need help with a custom error page that shows the error message details


I know how to alter the web config to redirect to an errors page but what I need to do is have the actual offending error message print to that page. This is a special request for testing reasons, I realize the whole point of a custom error page is to provide a user friendly message when an error occurs but for testing we want to show the user the message so they can copy and paste it into a ticketing system we are using for beta testing feedback.

Should I use the global.asax instead? I am pretty new to vb.net and am not sure how to get the actual error message to display on my custom error page. Any guidance would be greatly appreciated.


Very Basic Question - Error message running first page


Hi Everyone,

I am running Windows 7 and I have gone into Control Panel and activated all of the IIS Functions.

The web application I am running was downloaded from the net (and has worked on other machines previously).  Once I downloaded it, I moved it into C:/inetpub/wwwroot/code/main.asp

I am a bit of a novice at this!  But I am hoping someone can point me in the right direction!


I get the following error when I try and run the web application through IE:

"An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error."

(When i click the "click here" button it just goes to the IIS site).


Appreciate any help I can get!




Page.FindControl Causing Null Reference Exception


Hi guys,

I developed a page in VWD 2008 and it works perfectly locally, but when I deployed it on the server every Page.FindControl() call is causing the NullReference Exception "Object reference not set to an instance of an object. " Can anyone help me out? Code is below


Mike Marshall

            For i As Integer = 1 To 10
                If (CType(Page.FindControl("last_" & i), TextBox).Text.Length > 0) Or (CType(Page.FindControl("first_" & i), TextBox).Text.Length > 0) Or (CType(Page.FindControl("dob_" & i), TextBox).Text.Length > 0) Then
                    Dim person_entry(7) As String
                    person_entry(0) = info_list.Count - 1
                    person_entry(1) = CType(Page.FindControl("last_" & i), TextBox).Text
                    person_entry(2) = CType(Page.FindControl("first_" & i), TextBox).Text
                    person_entry(3) = CType(Page.FindControl("dob_" & i), TextBox).Text
                    person_entry(4) = CType(Page.FindControl("appear_" & i), TextBox).Text
                    person_entry(5) = CType(Page.FindControl("mental_" & i), TextBox).Text
                    person_entry(6) = CType(Page.FindControl("behave_" & i), TextB

Custom tool error: Failed to generate code for the service reference 'CompanyService'. Please che


A little background because I feel I have an out of the ordinary architecture in place and don't know if this is contributing to the problem. 

We have an existing ASP.net application that is undergoing expansion.  The new functionality is all written in Silverlight 4.  As part of that expansion I gutted all the old Linq to SQL and put Entity Framework 4 into place.  To do this I created a standard .net Class Library and added my edmx files there.  Naturally, the business entities created by this cannot be used in Silverlight.  So I created a Silverlight Class Library and added all the business entities to that Silverlight Class Library as linked files.  I changed the name space to be the same.

So I have the following assembly / namespaces

Company.Project.Dal.csproj / Company.Project.Entities (.net 4 class library)

Company.Project.Entities.csproj / Company.Project.Entities (SL4 class library)

With this architecture I was able to share my business entities with my SL enabled web services, my asp.net projects, my silverlight projects.  Really it's a beautiful thing.

Once this was done I added "message" classes to Company.Project.Dal and again shared them with the other entites using linked files.  These messages are things like MyObjectRequest; they are class

Interesting error message with content organiser: Cannot resolve mailbox (null) to a valid user

Here is a site with content organiser site feature enabled, as well as the email integration feature. Emails are successfully delivered to the "Submitted Email Records" list, but is never routed to the Drop Off Library. (the content organiser web service works fine and the drop off library works as a custom send to destination and happily processes its rules. If I turn up the debug juice I get the error "Cannot resolve mailbox (null) to a valid user" for every item in any "Submitted Email Records" in the site collection. Area: Document managagement Category: Content organiser EventID: 8000 Message: Cannot resolve mailbox (null) to a valid user I have temporarily worked around the problem by email enabling the drop off library but it creates an intermittent race condition (similar to certain workflow and event receiver situations), so its not a real solution (and in fact I assume thats why the Submitted Email Records hidden list exists in the first place). I've run procmon, specifically focusing on OSWTIMER and nothing interesting shows up at all. The error message is intriguing and I can't really think of what it is trying to do. In troubleshooting I noted that this farm had configured inbound email but not outbound email. I have since rectified this and de/reactivated the content organiser features and reset the timer service and IIS, b

Pass exception details to custom error page.

Hi All, I created a custom error page and update using webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, CustomErrorPage). Its working fine and my custom error page is show if error is occurred. OR We redirect using SPUtility.RedirectToErrorPage("my message"); But I am not able to find my exception details at my custom error page. Is there any way to pass the exception details and other custom information to custom error page?  

Custom error page

Hi all,I'm having VS 2008 professional. I want to generate a custom error page in my website. I added simple .htm file and wrote in it whatever i wanted it to display. Then I went to ASP.net configuration > Application > Define default error page and then selected my .htm file & saved it. After that if i tried to view my website in browser, it is not showing me the error page which i created instead it is showing the server error page which VS generally shows if there is some error in the code. Plz help to sort outSmitha

page version history gives error: "value cannot be null. parameter key: name"

Hello, I'm have customized my homepage in SharePoint Designer 2010. I want to go back to a previous version, so I right click on the aspx file in sharepoint designer and choose "version history". When I do that I get this message: There was an error connecting to the server. The server error encountered is "Value cannot be null. Parameter name: key" What should I do in order to revert my aspx page to a previous version ?

Simple error connection string null reference

 It is failing on SqlHelper.ExecuteNonQuery(System.Configuration.ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString     public static string GetAboutMeName(string sUserID, string connectionString)        {             SqlParameter[] parameters = new SqlParameter[2];                      parameters[0] = new SqlParameter("@sUserID", SqlDbType.VarChar, 50);            parameters[0].Value = sUserID;             parameters[1] = new SqlParameter("@sResult", SqlDbType.NVarChar, 1000);            parameters[1].Direction = ParameterDirection.Output;             // Execute the stored procedure            SqlHelper.ExecuteNonQuery(System.Configuration.ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString, CommandType.StoredProcedure, "sprGetAboutMeName", parameters);         &n

"403 forbidden" Error in my Custom login page

Hi All,   I Created a custom login page using Sharepoint Application page which is cofigured with FBA using this article http://blogs.msdn.com/b/kaevans/archive/2010/07/09/creating-a-custom-login-page-for-sharepoint-2010.aspx. But I keep getting the "403 forbidden" error. Can anyone suggest me a solution. Thank you.

Displaying custom error page


For certain parts of the site the allow inserting and updating of data we have some try / catch logic in place..

Now we would like to display a custom error page explaining what didnt happen. Instead of just a generic message that says error occurred.

Here is 1 error that is generated due to Primary Key constraints, we woudl like to redirect them to our error.aspx page which is already setup and configured in the web.config but within that page display a more user friendly detail message of why they got the error. In the example below, we may want to say, "There was an error with the "Access Insert" please make sure that the values you entered on the previous page are unique" thats just an example, but gives an idea of what we are trying to do.



Server Error in '/' Application.

Access Point Insert Error:Violation of PRIMARY KEY constraint 'PK_AccessInfo'. Cannot insert duplicate key in object 'dbo.AccessInfo'.
The statement has been terminated. 
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.Exce

The page cannot be displayed error when creating new item in custom list


Hi i am workign with a cutom list and every time i try to add a new item and hit ok i get the error shown below. Sometimes it happens and other times it doesnt and it only happens with a select few. One way of getting around this error is to not edit it on the page on which it is on but to go to view all content then to the custom list.

I have tried observing whether there was an issue with the pages being checked in and checked out but all pages were checked in and published. I tried deleting and recreating the custom list and no luck. Your feedback would be much appreciated! Thanks in advanced

btw i am a user with full control and our site is being hosted.

The page cannot be displayed


Best way to avoid error message due to null vs integer incompatibility


I receive the error message below, I think because the database field in question is null (I realize I probably should not allow null values, but I can't even display the page to allow the user to enter a value---and I would prefer not to enter a default value in SQL).

How do I avoid this error message? If the column is null (and it is supposed to be an integer), do I need to change the value to something like "0" in the code behind---or is there any easier way to do this right in aspx page (see source of error message below)?  Either way, I'm not sure how to do either (I can't get any such lines of code to work here). Thank you.


Object cannot be cast from DBNull to other types.

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.InvalidCastException: Object cannot be cast from DBNull to other types.

Source Error:

Line 50:  <td><ItemTemplate>
Line 51:    <asp:Label ID="PriceLabel" run

creating custom error page


Hi ..

I have two errors in my application i want to display a custom  defferent error page for each error...

Here is my code

protected void Button1_Click(object sender, EventArgs e)
            int a = 10;
            int b = 0;
            int c = a / b;
      // FIRST ERROR

    protected void Button2_Click(object sender, EventArgs e)

            string str = "hjdfgjh";
            int vv = Convert.ToInt32(str);
        //SECOND ERROR

i have configured web.config like b

Access Denied Error Message from Custom Webpart



I am new to MOSS so can anyone please help me to solve this problem.


I've a list in MOSS-2007, and a group of people with Read Only Rights so they cannot change any list item. But I want to give them access to edit one column (i-e Comments) in that list.

So I created a custom web part page and put a comments text box in it. At DispForm.aspx page of list there is a link which redirects to Custom page for adding comments and I am passing Item ID in query string.

But the problem is that when anyone adds the comment on custom page an ACCESS DENIED message appears. I've even set "web.AllowUnsafeUpdates = true" but didn't work


                SPWeb web = SPContext.Current.Web;
                SPList lstTIX = web.Lists["ListName"];


Response.Redirect cannot be called in a page callback error message.


Hi.  I'm using the Dundas Chart Controls in VS 2005.  These controls are built utilizing AJAX.  I have a basic page with a dundas chart control containing a funnel chart.  The funnel contains Quotes, Sales Orders and Invoices.  When the user clicks on the control, I want to determine whether they clicked on Quotes, Sales Orders or Invoices and transfer to the appropriate Details Page.  I've got the code working to determine which transaction type they clicked on; but, I get the "Response.Redirect cannot be called in a page callback." error when the page tries to redirect.  Note: I get a similar issue if I try server.transfer.


 Here's my code:

Dim hitTestResult As Dundas.Charting.WebControl.HitTestResult = Chart1.HitTest(e.X, e.Y)

            If Not (hitTestResult Is Nothing) Then

                Dim clicked As Dundas.Charting.WebControl.DataPoint = hitTestResult.Series.Points(hitTestResult.PointIndex)

                Select Case hitTestResult.PointIndex
                    Case 0


I can not create Article page in publishing site with a error message related to Microsoft SharePoin


I installed MOSS 2010 successfully with all requirements and options. After that It created a Publishing site. But, when I create an article page for news, the error page show that:


File Not found Trouble Shoot issues with Microsoft SharePoint Foundation (*).

Correlation ID: 5cce256-b30b-477d-9820-c46238f224a

Date and Time: ...


*:it's a link to open an error windows like this Besides, if i create a site with other templates (not Publishing template), I can not also start Publishing feature

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