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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:33:49+00:00 2026-06-09T00:33:49+00:00

I am using Sitecore and I have to show the first page in a

  • 0

I am using Sitecore and I have to show the first page in a collection of pages. Here is my code so far:

private Item currItem = Sitecore.Context.Item;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (currItem.HasChildren || currItem.TemplateID == new Sitecore.Data.ID("45D58815-A301-4393-9BA0-30A00C9BB993"))
            {
                var getFirstChild = (from Item item in currItem.GetChildren()
                                     select item).First();
                if (getFirstChild.TemplateID == new Sitecore.Data.ID("45D58815-A301-4393-9BA0-30A00C9BB993") && getFirstChild != null)
                {
                    //Server.Transfer(getFirstChild.Paths.Path);
                }

                else
                {
                    //Load Generic Page!
                }
            }
            else
            {
                //Load Generic Page!!!
            }
        }
    }
  • 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-09T00:33:52+00:00Added an answer on June 9, 2026 at 12:33 am

    You can use Response.Redirect or Server.Transfer. I would recommend Response.Redirect if you can:

    Server.Transfer Vs. Response.Redirect

    EDIT:

    OK you can do this:

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (currItem.HasChildren || currItem.TemplateID == new Sitecore.Data.ID("45D58815-A301-4393-9BA0-30A00C9BB993"))
                {
                    var getFirstChild = (from Item item in currItem.GetChildren()
                                         select item).First();
                    if (getFirstChild.TemplateID == new Sitecore.Data.ID("45D58815-A301-4393-9BA0-30A00C9BB993") && getFirstChild != null)
                    {
                        Response.Redirect(getFirstChild.Paths.Path);
                    }
    
                    else
                    {
                        //Load Generic Page!
                    }
                }
                else
                {
                    //Load Generic Page!!!
                }
            }
        }
    

    Response is a property of the Page so you can use it to redirect.

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

Sidebar

Related Questions

I want to create an item to sitecore using code behind. I found this
In a Sitecore 6.5 solution, i have the following; <sc:Text runat=server Field=bodyText/> and Sitecore.Context.Item[bodyText]
We are using IIS 7.5(windows 7 and integrated mode) and SiteCore 6.4. I have
Lets say I have a parent item and three child items in sitecore cms
I'm trying to debug Sitecore 6 ASP.NET code using Visual Studio 2008 (Windows Server
I'm using Sitecore and have a multilist field I'd like to use Lucene to
We are using Sitecore 6.5 and we have Email campaigns setup and the emails
I have clients who are using sitecore for their site. Its over bloated and
I have a set of Sitecore nodes: <item> <item> <item /> </item> <item />
While learning Sitecore I have found that the majority of Sitecore sample code on

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.