Web Forms :: Unable To Read Web.config File/Object Reference Not Set To An Instance Of An Object

Nov 2, 2010

I have a website written in C# that was running fine on one server. We moved it to another server and have a couple issues. I am mainly a VB.NET coder but can do a few things in C#. This is not a project - it is a website and can open it in VS2008 no problem. This is an admin site for the whole website where the user can add customer comments, etc. When logging in, it works fine. I can go to one of the admin pages after logging in and works. If I go to two other different pages, I get this error:

Object reference not set to an instance of an object.

[Code]....

It turns out this is in the main.master page and it is used by the other pages that load fine. The ApplicationTitle variable is set right in the web.config file and like I said, it shows on the other pages.

My question is why would this code work fine for some pages and not two others? All of these admin pages are under a folder called Admin and the web.config file is in the root folder of the website. Its almost like these two pages cannot see the web.config file in the root folder? Why would that be if thats the case?

View 3 Replies


Similar Messages:

WCF / ASMX :: Server Was Unable To Process Request / Object Reference Not Set To An Instance Of An Object?

Apr 16, 2010

I have a webservice, it has few webmethods. when i create a client proxy and invoke the methods to check its response, i am getting this error. Can someone tell me what things can i check to know the cause of this? The error is not saying much hence blocked on this.

View 1 Replies

MVC :: File Upload Error: Object Reference Not Set To An Instance Of An Object?

Nov 5, 2010

Attempting to upload a file to a database and was wondering if someone could help me a bit as I've gotten a bit stuck, and there are no errors except when I run the application. The error I get when I run the app is: System.NullReferenceException: Object Referencenot set to an instance of an object. This error occurs on the line:

[Code]...

View 8 Replies

Web Forms :: Object Reference Not Set To An Instance Of An Object Error When Remove Reference To Site Master Page

Sep 30, 2010

in my default.aspx page i have a dropdown List and a textbox with a submit button below that there are 2 listbox... and the dropdown list holds the names of the listbox

my logic here is to select an item from the dropdown list and put some text in the text box and submit the form which will add an item to the listbox selected.. but when i do this i get an error saying Object reference not set to an instance of an object. i tried to figure out the problem and found that when i remove the reference to the Site Master Page it works fine and when i undo and apply my reference back to the Site Master Page i get the same error.

[Code]....

View 2 Replies

Web Forms :: Session Ended - But Server Error/ Object Reference Not Set To An Instance Of Object?

Nov 15, 2010

In the VS2005 environment, when I test my session to make sure the page redirects to the main page (itself) if the session is null, it works. There is no error.

The function I use for this is:

[code]....

However, when it is in the production environment in IIS 6.0, when the session has timed out, and I then do a postback by doing some slider control, I see the page reload but immediately thereafter, it throws a Server Error exception of : Object reference not set to an instance of object.

Looking at the stack trace, the event occured:

AJAXEnabledWebApplication1._Default.Slider1_TextChanged(Object sender, EventArgs e)

however, why is it that the Slider1_TextChanged event fired even even after during page_load, the page was told to do a response.direct ?? shouldn't the entire page have gone through a full-page refresh life cycle ? why did it continue on to attempt to raise the Slider1_TextChanged event?

View 1 Replies

Forms Data Controls :: Object Reference Not Set To An Instance Of An Object Repeater Control

Apr 21, 2010

can you please help me to brainstorm the possible causes of this error. I've got a paged repeater with localisation bound programitcally to an sqldatasource using a stored proc. I can post code if needs be but it's rather long. I'm looking for typical causes of this error + will make note for future reference!

erver Error in '/WebSite4' 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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

[Code]....

Line 233:Line 234: Repeater1.DataSource = PagedResultsLine 235: Repeater1.DataBind()Line 236: doPaging()Line 237: End Sub

View 9 Replies

Forms Data Controls :: Get The Value Of The Id Field In Gridview/Object Reference Not Set To An Instance Of An Object

Feb 1, 2010

I am trying to get the value of the id field in my gridview but I keep coming up with this error when i do selectedValue or selecteIndex

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

How do I get that id? What I am trying to do is when the user select that link it will delete that information from the database. Here's my code:

[Code]....

[Code]....

View 5 Replies

Web Forms :: Error When Using A BasePage Along With A Master Page/ Object Reference Not Set To An Instance Of An Object

Mar 6, 2010

I'm new to programming in ASP.NET, but I'm making my way through Wrox's Beginning ASP.NET 3.5 in C# and VB.NET.

I'm at a section where I'm creating a BasePage. I successfully created a BasePage by creating a new class file in my App_Code folder called BasePage.cs with the following code:

[Code]....

If I run that code everything works out fine. The page loads and all is well. But, if I try to do the same thing to a page that uses my MasterPage.master file, I get the following error:

Object reference not set to an instance of an object.

Description:

An unhandled exception occurred during the execution of the current web request. 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.

Why is that? In the example code from the book (that also uses a MasterPage.master file), everything excutes and runs just fine. But in my test, I get the above error. I've tried comparing my pages to the books included source pages, but I can't find any differences.

View 1 Replies

Web Forms :: Accessing Control In Usercontrol / Error: Object Reference Not Set To An Instance Of An Object

Apr 19, 2010

In the same Code behind file I have:

// This works

Label lblTopNavBarInfo = (Label)Master.FindControl("lblTopNavBarInfo");

lblTopNavBarInfo.Text = "Currently Serving: + FirstName + " " + LastName ;
// This compiles but throws an error in the browser

LinkButton lnkBtnProductsOwned = (LinkButton)LeftNav_CustServ1.FindControl("ProductsOwned"); // The Control is visible

lnkBtnProductsOwned.Enabled = false; // Error: Object reference not set to an instance of an object.

View 6 Replies

Web Forms :: Error When Converting Session To String / Object Reference Not Set To Instance Of Object

May 7, 2015

I am getting object refernce error at line:if (Session["Tax"].ToString() == "9")

protected void Page_Load(object sender, EventArgs e)
{
if (Session["Tax"].ToString() == "9")
{
lblTax.Text = Session["Tax"].ToString();
}
else
{
lblTax.Text = "0";
}
}

Is anything wrong I have done?

View 1 Replies

Web Forms :: Returns Object Reference Not Set To An Instance Of The Object Because Of Empty Dataset

Aug 27, 2010

private void FillDetails(string pId, out string Name, out string Address)

[code]....

I have method called Filldetails(),This method uses stored procedure to retrieve information for product name and address based on productid passed from productdetails table.I am working on globalization project.We have this product information for US country but there is no product information for germany country.So dataset is empty for germany.As result I am getting error object reference not set to an instance of the object.

View 3 Replies

Web Forms :: Error When Adding To Listbox / Object Reference Not Set To An Instance Of An Object

Feb 19, 2010

I have just recently converted my VB code to C# and now having this error when I try to add an item to my listbox, and the value is coming from the item page. I get the error at this segement:

lstboxCart.Items.Add(cartItem.Display());

My listbox is supposed to add the product's name, quantity, and price onto one row.

Here's what I have so far:

[code]...

[Code]....

[Code]....

My guess is that the source of the problem could be in the foreach loop from my cart class, shouldn't I be using that for arrays only? If I need to post any markup code or any other class, let me know.

View 7 Replies

Forms Data Controls :: Get Error : Object Reference Not Set To An Instance Of An Object

Dec 2, 2010

I have a nested gridview

i get error:Object reference not set to an instance of an object

when i try to get the text in the footer template of the inner gridview when clicking on the linkbutton!!!

[code]....

View 5 Replies

Forms Data Controls :: Error : Object Reference Not Set To Instance Of The Object

Feb 3, 2010

I am using C# and VS 2008 attached with access database, where Date1 is the PKey in Text defined.

I am getting the above error when i am trying to insert it into the access database.

here is my code

aspx :

[Code]....

Code Behind :

[Code]....

View 5 Replies

Web Forms :: Dropdownlist.items.findbyValue(value) - Getting Object Reference Not Set To An Instance Of An Object

Jan 13, 2010

I am trying to use

[Code]....

with values I get from a database but I am getting Object reference not set to an instance of an object.

View 11 Replies

Forms Data Controls :: Get An "Object Reference Not Set To An Instance Of An Object?

Nov 14, 2010

My problem is I get an "Object reference not set to an instance of an object." error at runtime on the line "ddl2.SelectedValue = cat1". Ironically I got this from an example on the internet and the only difference is my Cat1 varible which has the correct value at runtime.

<asp:FormView
id="frmCustomer"
DataSourceID="srcCustomer"[code]....

View 15 Replies

Forms Data Controls :: Gridview And Object Reference Not Set To An Instance Of An Object?

Jul 10, 2010

I would like to enable/disable the field BagNo in my gridview, depending on the value of another field in the gridview called ScriptNo, when I click the edit button I get this message "Object reference not set to an instance of an object".

here is the code

Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim row As GridViewRow = GridView1.Rows(e.NewEditIndex)
If DirectCast(row.FindControl("ScriptType"), TextBox).Text = "TTA" Then

[Code]....

View 6 Replies

Web Forms :: Object Reference Not Set To Instance Of Object Error Happen When Use 2 Linkbutton

Apr 27, 2016

I have two datalist that bind from database and use linkbutton on these datalist

<asp:DataList ID="DLclass" runat="server">
<ItemTemplate>
<asp:LinkButton ID="Linkbtnclass" runat="server" CssClass="lbldasteM"
CommandArgument='<%# Eval("Name") %>' OnClick="Linkbtnclass_Click"><%# Eval("Name") %></asp:LinkButton>
<div id="MM31"></div>

[Code] ....

Here I want when click on linkbutton it change text's color so I wrote below code:

protected void c(object sender, EventArgs e)
{
this.GetCustomersPageWiseMC(1, (sender as LinkButton).CommandArgument);
BindDataListD(DLclassC, "classTI_documentry");
DataListItem item = (DataListItem)(sender as LinkButton).NamingContainer;
foreach (DataListItem dlItems in DLclass.Items)

[Code] ....

For Linkbtnclass_Click it worked correctly and when I click on linkbutton it change color but for LinkbtnclassC_Click  when I click on linkbutton it make this error:

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 537: {
Line 538: LinkButton lb1 = dlItems1.FindControl("Linkbtnclass1") as LinkButton;
Line 539: lb1.ForeColor = ColorTranslator.FromHtml("#646464");
Line 540: }
Line 541:

View 1 Replies

Web Forms :: Reading Cookies - Object Reference Not Set To Instance Of Object Error

Aug 4, 2012

I am using following code for remember me check box

protected void Page_Load(object sender, EventArgs e)  { 
if (!IsPostBack)  { 
if (Request.Cookies["username"].Value != null && Request.Cookies["password"].Value != null) {               
txtuser.Text = Request.Cookies["username"].Value;               
txtpwd.Attributes["value"] = Request.Cookies["password"].Value;           

[Code] ....

When I execute the application first time

'Object reference not set to an instance of an object'

error occur..

How to check the cookies or exist or not in local machine?

View 1 Replies

Web Forms :: DropDownList FindByText - Object Reference Not Set To Instance Of Object Error

Jul 12, 2013

In manager.aspx page I have gridview that bind product information from database in this gridview I define linkbutton EDIT that when users click on it they go to Edit.aspx page and in this page users can see their product information and Edit them

In Edit.aspx page I use some textbox and dropdownlist and bind them from database

int data1 = Convert.ToInt32(Request.QueryString["Id"].ToString());
SqlCommand _cmd = new SqlCommand("viewProduct", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cmd.Parameters.AddWithValue("@id", data1);
_cn.Open();
SqlDataReader _dr = _cmd.ExecuteReader();

[Code] ....

When I click on EDIt linkbutton from gridview it go to Edit.aspx page and bind all  data from database and ofcourse show data in Dropdownlist untill now every thing is ok

but when I change some Item in this page i.e Name of product when I changed and clicked on button to update table in database it update data in database but below error happen too

Server Error in '/behtop website' 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.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

Line 79:
Line 80:
Line 81: DDL1.Items.FindByText(_dr["classification"].ToString()).Selected = true; Line 82: DDL2.Items.FindByText(_dr["subset"].ToString()).Selected = true;
Line 83:

And when I back to manager.aspx and again click on Edit linkbutton to Edit that product it didn't load Edit.asp page and above error happen again...

This error happen just when I want edit product information in other time if I don't edit any thing edit.aspx page load successfully...

View 1 Replies

Forms Data Controls :: Cannot Access Header Row Error / Object Reference Not Set To An Instance Of An Object

Jul 2, 2010

I tried to get the heade row text with the following code, but it failed.

[Code]....

Error returned was "Object reference not set to an instance of an object." on this line:

[Code]....

View 3 Replies

Forms Data Controls :: Grid View OnDataRowBound Error: Object Reference Not Set To An Instance Of An Object?

Jul 2, 2010

The stored proc fired to populate my grid view gets a column CasNo.The GridView has a DataBound item for CaseNo.

[Code]....

Then Why does this get null value: string caseNo = dataRow["CaseNo"] as string;
[Code]....

[Code]....

View 14 Replies

Forms Data Controls :: How To Access A LinkButton Inside A Repeater/Object Reference Not Set To An Instance Of An Object

Jan 16, 2010

why I get this error:

Object reference not set to an instance of an object.

when I try to access a LinkButton inside a Repeater as follows:

[Code]....

[Code]....

View 4 Replies

Forms Data Controls :: ItemTemplate And EditTemplate Rowdatabound Trigger/ Object Reference Not Set To An Instance Of An Object

Sep 7, 2010

I need to change the row.forecolor = drawing.color.red.

in my gridview i have a STATUS field, its ItemTemplate is LABEL1 and its EditTemplate is DropDownList1.

on loading I have successfully changed the forecolor, but when I edit it gave me an error:

Object reference not set to an instance of an object.

View 7 Replies

Web Forms :: Error Handling For Object Reference Not Set To An Instance Of An Object?

Aug 17, 2010

This might have been asked before but I did a quick search and found nothing.

Problem: I want to get the name of the object that has a value of nothing and the type of the object when the "Object reference not set to an instance of an object error" occurs. The type obviously can be Object or specific. I want this information so that I can log a better error message in the error handling module. The only real useful information currently that comes back from the Exception object on a try catch is the line number at which the error occurred which in most cases is adequate except when you have functions calling functions, all in one line.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved