How to browse sitecore project as anonymous user - sitecore

I have built a sitecore site in my dev PC and published it. (From master to web database).
How can I browse the site as an anonymous user.
Say, if i browse the url mysite/pages/about, it loads the page but within the sitecore shell. (and also, I need to be logged in)
I would like to see it, as if it went live. Is this possible.

Since you are still logged into Sitecore by default it will use those credentials to load the page in "Edit Mode".
Use a different browser or open a tab in incognito/private browsing mode.
Alternatively, in Experience Explorer from the Home Ribbon section select "Close" or append ?sc_mode=normal to the URL of the page.
There is a cookie named website#sc_mode which will also be set to Edit when you are in Experience Editor, which remembers your last selection. You could also try removing this as well as the other Sitecore cookies.

There has to be a SiteDefinion.config file in the App_Config/Include folder, which is not avilable by default.
Lets say, the sitecore instance name is democore and you have to develop a website - mysite.
And your content tree may be structured as :
Sitecore > Content > MySite > (home, about, contact etc)
This config file will have the following configuration
<configuration xmlns:patch="www.sitecore.net/.../">
<sitecore>
<sites>
<site patch:before="*[#name='website']"
name="/"
hostname="democore"
virtualfolder="/"
physicalfolder="/"
rootpath="/sitecore/content/"
mediapath="/sitecore/media library/mysite/"
startitem="/home"
loginpage="/login"
database="web"
domain="extranet"
allowdebug="false"
cachehtml="false"
htmlcachesize="10MB"
registrycachesize="0"
viewstatecachesize="0"
xslcachesize="5MB"
filtereditemscachesize="2MB"
enablepreview="true"
enablewebedit="true"
enabledebugger="false"
disableclientdata="false"
language="en"
usedisplayname="true"
embedlanguage="false"
embedlanguageinmedia="true"
routesitename="mysite" />
</sites>
</sitecore>
</configuration>
You can now browse the site as democore/mysite/home

Related

Glass Mapper SitecoreInfo.Url not working as expected on multisite

I have an issue with mapping SitecoreInfoType.Url on a sitecore multisite solution.
I have in sitecore 2 websites:
Site A
Site B
Site A contains some articles:
www.Site-A/Articles/Article 1
www.Site-A/Articles/Article 2
On our main "Article landing page", we have a widget that shows a short description of each article with links to article page.
for using the url, we are mapping it with SitecoreInfoType.Url
e.g.
[SitecoreInfo(SitecoreInfoType.Url)]
public virtual string Url { get; set; }
This is rendered correctly as it is used on Site A, we get dynamic urls like /en/Articles/{Article Name}.
If we try to use the widget on Site B, the url is not generated as expected:
/en/sitecore/content/Site A/Home/Articles/{Article Name}
We already have implemented on website Sitecore fields of Link type and we are using UrlOptions for solving this kind of behaviour.
e.g.
[SitecoreField(UrlOptions = SitecoreInfoUrlOptions.SiteResolving)]
public virtual Link AlternateLink { get; set; }
This will generate the expected result. If we are trying to generate a Link for a target item that is under other website, domain will be used for generating url.
Target item is under Site A.
Widget is used on Site B and context is set to Site B
Link Url is generated like: www.Site-A/Articles/{Target item}
Unfortunately glass mapper is not mapping in the same way SitecoreField and SitecoreInfoType.Url.
Update on code:
[SitecoreInfo(SitecoreInfoType.Url, UrlOptions = SitecoreInfoUrlOptions.SiteResolving)]
public virtual string Url { get; set; }
And in similar context:
Target item is under Site A.
Widget is used on Site B and context is set to Site B
Link Url is generated like: /en/sitecore/content/Site A/Home/Articles/{Target item}
Note:
Other UrlOptions used on SitecoreInfoType.Url are working:
SitecoreInfoUrlOptions.AddAspxExtension
SitecoreInfoUrlOptions.AlwaysIncludeServerUrl
SitecoreInfoUrlOptions.LanguageEmbeddingNever
In case of using SitecoreInfoUrlOptions.AlwaysIncludeServerUrl the result is strange: www.Site B/en/sitecore/content/Site A/Home/Articles/{Target item}
For me it seems that this is a bug in glass mapper library.
Anyone had this issue and a fix or workaround?
I would prefer to not use Sitecore API and try to get the item and use LinkManager again as this is already used in glass mapper implementation.
Here is my site definition config:
<sites>
<site name="siteA"
patch:before="site[#name='website']"
hostName="siteA.domain.com"
targetHostName="siteA.domain.com"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/domain/siteA"
startItem="/Home"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
disableClientData="false"
scheme="http"
/>
<site name="siteB"
patch:before="site[#name='website']"
hostName="siteB.domain.com"
targetHostName="siteB.domain.com"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/domain/siteB"
startItem="/Home"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
disableClientData="false"
scheme="http"
/>
</sites>

Page Preview redirects to Login Page even tho the user is logged in

If I click on the preview button in the presentation or publish tabs, the user is redirected to the login page.
The web.config has site the site definition:
<name="website" loginPage="/login.aspx" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/Home" database="web" domain="extranet" enablePreview="true" enableWebEdit="true" />
The user has access to preview. I am using Sitecore 8.
Remove loginPage="/login.aspx" from your <site ... /> and see if that helps. Also, note that clicking the preview button from the Publish ribbon will open the site in preview mode in a new tab but clicking preview from the Presentation ribbon will open an editor frame preview of the site but it may resolve the context site as shell.

Sitecore 7.2 engagement analytics not recording data

I'm using Sitecore 7.2 DMS (Digital Marketing System) to personalize content based on pattern cards. The problem I'm having is that the engagement analytics tool is not recording any data.
I already troubleshooted the problem based on this post but I haven't had any luck. Summarizing I checked:
Sitecore.Analytics.config is in the Include folder
The Analytics DB connection string is correct
Analytics.DisableDatabase is false
I even add the enableAnalytics in the web.config (true by default)
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" enableAnalytics="true" />
Thanks in advance
Apart from configuration, your pages should have a VisitorIdentification tag, so that Sitecore will be able to collect tracking information. Please make sure you have got a correct tracking tag being set up on your custom page layouts.Below are examples for WebForms and MVC versions of Sitecore(correspondingly).
WebForms:
<sc:VisitorIdentification runat="server" />
MVC:
#Html.Sitecore().VisitorIdentification()
See previous SO question on that:
Sitecore Analytics
Disable Bots detection in the Sitecore Analytics config file. by default its true. Make it to false.

Error when setting default page in a multisite sitecore extranet

I have a multisite configuration, and one of the sites is a secure extranet
Not logged users (anonymous) will be redirected to the login page
the default page is home
So my configuration reads like this
<site name="aodextranet" hostName="preprod.aodextranet.org" virtualFolder="/"
physicalFolder="/" rootPath="/sitecore/content/Sites/Extranet"
startItem="/Home" database="web" domain="extranet" allowDebug="true"
cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0"
viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB"
enablePreview="true" enableWebEdit="true" enableDebugger="true"
disableClientData="false" loginPage="/login.aspx" />
if I go to mysite/home I'm redirected to the login page as expected
but if I only write mysite without the explicit reference to the home
page the sites throws an error: no layout page.
If /home is the start item in the configuration file, I should go to home and then redirected to the login page. I've tried upper and lower case without success
This is a screen cast
http://screencast.com/t/aiF0BNk4lWr
Any help would be really appreciated
The sitecore item /sitecore/content/Sites/Extranet/Home is the item that is shown when you navigate in the browser to preprod.aodextranet.org.
This item should have a layout and sublayouts/renderings added to the presentation tab.
Looking at your configuration it seems that you have misconfigured your site-definition or did not add the presentation elements to the item /extranet/home.
Found it!
After creating a new site in a multisite configuration, you have to publish the whole site... I was publishing only the site node plus the templates. After running the full publish, the site is behaving as expected.

sitecore multiple domains, shared items

I have a site in sitecore at domain1.com
<site rootPath="/sitecore/content" startItem="/home" .. />
I want to create a second site at domain2.com that uses same items
<site rootPath="/sitecore/content" startItem="/home" ... />
Both sites refer to same items in content tree. Clear?
The links generated by sc:path(.) (makes absolute links) on the domain2.com refer to domain1.com.
As far as I understand links refer to the first site in web.config that refered to the items in content tree.
How can I get valid links for both sites?
Just Rendering.SiteResolving to false.
The the sitecore will determine the urls' hostname from http request.