Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9024015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:54:12+00:00 2026-06-16T05:54:12+00:00

I have a search control, when the user clicking on search the query is

  • 0

I have a search control, when the user clicking on search the query is passing in the url (get mode) with the following line from the code behind:

 Server.Transfer("portfolio_search_results.aspx?search=" + query); 

now i have a very strange problem, if the user is clicking on the search button the search works fine, but if the user click search again the error

Object reference not set to an instance of an object.

is raising. going to other page after the search and searching again works fine, this is happening only when clicking search button twice in a row.
the search control is in the top of the page inside the master.
the code in the search function:

    SqlCommand cmd = new SqlCommand("something", _mainConnection);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add(new SqlParameter("ID", SessionManager.Session[SessionParam.ID].ToString()));
    cmd.Parameters.Add(new SqlParameter("Type", type));
    return _mainDb.ExecuteDataSet(cmd).Tables[0];

and the error is in the session.

If i am using Response.Redirect instead of Server.Transfer it’s not working at all and getting the above error even in the first time searching.

edit: adding stack trace.

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:


[No relevant source lines]


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\e76777bb\bf0abb72\App_Web_portfolio_search_results.aspx.cdcab7d2.jiztmxz2.0.cs    Line: 0

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   Appeals.GetAppeals(String typeAppeals) +104
   search.make_dt() +21
   search..ctor() +311
   portfolio_search_results..ctor() +26
   ASP.portfolio_search_results_aspx..ctor() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\e76777bb\bf0abb72\App_Web_portfolio_search_results.aspx.cdcab7d2.jiztmxz2.0.cs:0
   __ASP.FastObjectFactory_app_web_portfolio_search_results_aspx_cdcab7d2_jiztmxz2.Create_ASP_portfolio_search_results_aspx() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\e76777bb\bf0abb72\App_Web_portfolio_search_results.aspx.cdcab7d2.jiztmxz2.1.cs:0
   System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
   System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
   System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


Version Information: Microsoft .NET Framework Version:2.0.50727.3634; ASP.NET Version:2.0.50727.3634 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:54:13+00:00Added an answer on June 16, 2026 at 5:54 am

    I solve it by passing the session as parameter to my classes in App_code directory in my project instead using the session parameter inside the App_code classes.
    so the study is that session wouln’t be use in the app_code directory .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight user control that is a textbox with a search button
I have made one custom user control (search text box), which basically consists of
I have a User Control with with some search functionality, then I also have
The question raised from the question here . In order to have search engines
I'm writing a user control with a dependency property for a search text called
I have a search box on my site, whereby the user enters a term
I am tring to add a user control to do a search. this user
I have a user control with several child controls. I need the user interface
I have a data navigation user control in Silverlight which opens a child window
I have a User control (because I use the same in other page, so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.