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 6552697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:29:29+00:00 2026-05-25T12:29:29+00:00

I have a c# asp.net MVC project. I am doing a a search and

  • 0

I have a c# asp.net MVC project. I am doing a a search and want to access the search results on the details page of one of the search results.

This is so that I can have < prev | next > links on the detail pages that will link to the next property in the last search results.

My approach so far is to put the search results object into a session variable, but I can’t figure out the code to actually access it. When I do a watch on Session["SearchResults"] below, I can see the records in the Result View, which seems to hold an array.

I know someone is going to tell me I’m thinking about this all wrong, and I can’t wait to be enlightened.

Someone suggested I should just store the last search results on the repository as a public property, would that be a better option? Or can someone recommend an altogether better way of doing what I need to do?

This is my controller

public ActionResult Search(int? page, Search search)
{

    search.regusApi =  Convert.ToBoolean(ConfigurationManager.AppSettings["regusApiLiveInventory"]);
    Session["SearchResults"] = MeetingRoomRepositoryWG.Search(search).AsPagination(page ?? 1, 7);

    return View(new SearchResultsWG { SearchCriteria = search, Locations = MeetingRoomRepositoryWG.Search(search).AsPagination(page ?? 1, 7) });
}

public ActionResult NiceDetails(String suburb, String locationName, int id)
{
        **Here I want to acceess the session variable**

        return View(MeetingRoomRepositoryWG.RoomDetails(id).First());
}

Here is the code from the repository:

public static List<Location> Search(Search search)
{

    String LongLatString = search.LongLat;
    LongLatString = LongLatString.Substring(1, LongLatString.Length - 2);

    var LonLatSplit = LongLatString.Split(',');
    var latitude = Convert.ToDecimal(LonLatSplit[0]);
    var longitude = Convert.ToDecimal(LonLatSplit[1]);

    using (var context = new MyContext())
    {
        var query = context.Locations.Include("Location_LonLats").ToList();

        query.OrderBy(x => (Convert.ToDecimal(x.Location_LonLats.Lat) - latitude) * (Convert.ToDecimal(x.Location_LonLats.Lat) - latitude)
                 + (Convert.ToDecimal(x.Location_LonLats.Lon) - longitude) * (Convert.ToDecimal(x.Location_LonLats.Lon) - longitude));

        return query;
    }
}
  • 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-05-25T12:29:30+00:00Added an answer on May 25, 2026 at 12:29 pm

    Not sure how large the data is you search against but, it’s better to not store search results at all. It will scale very poorly and become a resource hog quite easily. Why store e.g. 500 pages of search results if the user only ends up looking at 1 or 3?
    How long are you going to hold these potentially large result sets in session storage? For how many users?

    Just do a page based search, essentially redoing the search for each “next” click the client does. A good index or something like Lucene.net can help if your searches are too slow.

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

Sidebar

Related Questions

We have an ASP.Net MVC project that will start with a single web server
I have an Asp.net MVC project that modestly uses jQuery scripts. My views also
I have a hybrid ASP.NET WebForms/MVC project. In my Master Page, I have a
I have an ASP.NET MVC project that works fine on my local machine (no
I'm doing project in asp.net mvc with Micorsoft Access database and I need to
I have an ASP.NET MVC 3 project that I just created using the project
I have an ASP.NET MVC 2 project that renders conventional strongly typed pages, but
I have ASP.Net MVC project. Plus wordpress blog under a subfolder /Blog. Now, when
I have an ASP.NET MVC project with xVal and data annotations and I need
I have a new asp.net mvc project and i am trying to figure out

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.