SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

TIP: Using code blocks in master pages throws error

If you want to use script tags for dynamic content in a master page, for example:

 <%= DateTime.Now %>

and you recieve the following error:

Include the following in your web.config file to resolve this issue:

 

 


Posted 06-28-2007 9:00 AM by mhcello

Comments

Kevin Cornwell wrote re: TIP: Using code blocks in master pages throws error
on 06-28-2007 9:45 AM

Can't read the web.config image (nor copy paste).

mossman wrote re: TIP: Using code blocks in master pages throws error
on 06-28-2007 11:10 AM

I have heard from some sources that this practice is frowned upon for security reasons. I'm guessing this COULD allow users with certain privileges to run code in their master pages they have added with sharepoint designer. Though, I could perhaps argue that if you can't trust them with spd access... maybe you should be able to trust them with this.

mossman wrote re: TIP: Using code blocks in master pages throws error
on 06-28-2007 11:11 AM

I meant to say "if you CAN trust them with spd access"...

Links (6/28/2007) « Steve Pietrek’s SharePoint Stuff wrote Links (6/28/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff
on 06-28-2007 8:42 PM

Pingback from  Links (6/28/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

RChakravarti wrote re: TIP: Using code blocks in master pages throws error
on 07-19-2007 8:04 AM

Kevin,

Sorry about you not being able to read the images. I have attempted to resolve that in this post, please click on the image and it should open up in a new window in a more readable form.

Regards,

Rajiv

relishguy wrote re: TIP: Using code blocks in master pages throws error
on 02-28-2008 5:44 PM

Of course, you can also update the master page in the filesystem..then code will be executed correctly.

Regards..

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.