November Happy Hour will be moved to Thursday December 5th.

MVC - How to get a specific page data so I can redirect to it?

Vote:
 

I have a login form on my layout which posts to a controller that uses Membership to validate the user.

Once validated, I want to redirect them to a specific page.

How do I do this the "EPiServer Way"? I could just enter the url manually but that doesn't feel right. I also need to take into consideration which language branch the user is currently using.

#76725
Oct 31, 2013 16:15
Vote:
 

Would it not just be ?

var page = DataFactory.Instange.GetPage(pageRef);

Response.Redirect(page.LinkUrl);

 

or

 var repository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>();

 var v = repository.Get<IContent>(new ContentReference(intValue));

Response.REdirect(v.LinkURL)

#76727
Oct 31, 2013 16:37
Vote:
 

So I need to know the id of the page so that I can pass that into the ContentReference constructor?

#76729
Oct 31, 2013 16:54
Vote:
 

Yes all page's have a PageReference

#76730
Oct 31, 2013 16:56
Vote:
 

You can store this ID either in a config file, database table or store it as a property on a page type (start page normally).

#76733
Oct 31, 2013 19:09
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.