Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm working on a SharePoint-Hosted application and wondering how I can add C# code to the .aspx files. When creating Auto-Hosted and Provider-Hosted apps, they displayed a C# script for every page.

Is this not possible?

Thanks for your help!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

No this is the major limitation of SharePoint hosted apps.

To be able to run server side code you need to develop auto hosted or provider hosted apps.

See MSDN for complete comparison between the hosting options

share|improve this answer
    
I thought that might be the case. I initially tried auto-hosted and provider-hosted apps, but wasn't able to use Microsoft.SharePoint.WebControls to use the SPWeb and SPUser class functions. Can you use WebControls on provider/auto hosted apps? –  Graham May 16 '13 at 12:59
    
In the App model, you are no longer able to use the server-side object model. You are now using the client side object model. You will want to use Microsoft.SharePoint.Client –  Brian P May 16 '13 at 15:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.