You need to sign in to do that
Don't have an account?
Dominic Sebastian
Fetching the User ID at Sites while redirecting a page.
While executing the login for a portal at Site.com. The login portal will reditrct to another page. The problem that I am dealing with is that, the page to which it's redirected needs the User. Id in order for it to process. I have used the "ApexPages.currentPage().getParameters().get('Id')". In order to fetch it. But somehow, it'snot working.
global class SiteMiniMouseController{
global String username {get; set;}
global String password {get; set;}
global PageReference login() {
String startUrl = System.currentPageReference().getParameters().get('start');
String PageId= UserInfo.getUserId() ;
String pageUrl = '/apex/MickeyMouse?id=PageId';
if (startURL != '' && startUrl != NULL && startUrl != 'null') {
pageUrl = startUrl;
// pageUrL = PageId;
}
System.debug('pageURL: ' + pageURL);
PageReference page = Site.login(username, password, pageUrl);
if (page == null ) {
System.debug('Invalid username or password!');
}
return page;
}
global SiteMiniMouseController(){}
}
global class SiteMiniMouseController{
global String username {get; set;}
global String password {get; set;}
global PageReference login() {
String startUrl = System.currentPageReference().getParameters().get('start');
String PageId= UserInfo.getUserId() ;
String pageUrl = '/apex/MickeyMouse?id=PageId';
if (startURL != '' && startUrl != NULL && startUrl != 'null') {
pageUrl = startUrl;
// pageUrL = PageId;
}
System.debug('pageURL: ' + pageURL);
PageReference page = Site.login(username, password, pageUrl);
if (page == null ) {
System.debug('Invalid username or password!');
}
return page;
}
global SiteMiniMouseController(){}
}
Try this instead. Thank you
All Answers
Try this instead. Thank you