Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

How to get page Start id in Episerver 7.5



I have below code in episerver 6 

var startPage = EPiServer.DataFactory.Instance.GetPage(new PageReference(EPiServer.Configuration.Settings.Instance.PageStartId));

How to convert this to episerver 7.5 

Please suggest

Oct 23, 2019 12:33
Dinesh Yadav - Oct 23, 2019 12:35
is the below correct ?
var startPage =
new PageReference(EPiServer.Web.SiteDefinition.Current.StartPage));

Hi Dinesh,

Please use this-

Oct 23, 2019 13:05

For 7.5 you should be using IContentRepository instead of DataFactory. And new PageReference(EPiServer.Configuration.Settings.Instance.PageStartId) is now replaced with EPiServer.Web.SiteDefinition. ContentReference.StartPage can also be used as it is equipvalent to SiteDefinition.Current.StartPage by default. 

Oct 23, 2019 13:16
Dinesh Yadav - Oct 23, 2019 13:22
Thanks very much Mai,

One more help , how will i get the siteDisplayName , in the below code please
Quan Mai - Oct 23, 2019 13:25
It would be SiteDefinition.Current.Name
Dinesh Yadav - Oct 23, 2019 13:31
The above gives you site id not name .. in my case i am getting 321
Dinesh Yadav - Oct 23, 2019 13:40
Got it i changed in the Admin the site name
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.