c# - How can I make sitecore showing an image (or other resources) -
i installed clean sitecore 6.6 , enabled mvc back upwards using guide. environment sitecore 6.6, asp .net mvc 3 , razor, microsoft sql server express 2012, iis 7.5 , i'm using microsoft visual studio 2012 express web. have next code:
@model.pageitem.fields["title"];<br /> @model.pageitem.fields["image"].getvalue(true, true);<br /> @model.pageitem.fields["text"];<br /> sitecore.data.items.mediaitem item = model.pageitem.fields["image"].item; @sitecore.stringutil.ensureprefix('/', sitecore.resources.media.mediamanager.getmediaurl(item));<br />
result simple:
sitecore <image mediaid="{4dfd3abc-0bc0-41d2-bd38-705946a1368a}" mediapath="/images/xbox" src="~/media/4dfd3abc0bc041d2bd38705946a1368a.ashx" /> <p>welcome sitecore</p> /sitecore/shell/~/media/110d559fdea542ea9c1c8a5df7e70ef9.ashx
when navigate path specified in lastly line next error:
http error 404.0 - not found resource looking has been removed, had name changed, or temporarily unavailable.
i tried few things, e.g.:
media.useitempaths in web.config changed trye (or false) - nil works... media.requestextension in web.config set empty (ashx default) i have added ashx allowed extensions in web.config (because if cant have normal extensions, @ to the lowest degree want have working ashx link) i have added ashx iis 7.5 -> request filtering -> file name extensionsof course of study after each alter (just in case) restarted server , cleared browser's cache (actually, after few requests have disabled cache chrome).
i looking solution on sdn.sitecore.net no luck. i've spent more 3 hrs far looking solution , can't figure out going wrong... help or suggestions appreciated!
the field method of sitecore.mvc.helpers.sitecorehelper class allow output image field.
here's illustration view rendering outputs 3 fields:
@using sitecore.mvc.presentation @using sitecore.mvc @model renderingmodel @html.sitecore().field("title")<br /> @html.sitecore().field("image")<br /> @html.sitecore().field("text")<br />
john west has blogged extensively on sitecore mvc, might @ about mvc helpers sitecore asp.net cms post.
c# .net sitecore sitecore6
No comments:
Post a Comment