-3

I am using "SharePoint Online" and I'm new to it. I have descend programming background and I need more Info on customisation of this service. I've never worked with .NET before (WHAT?!), but I would really like to learn more about C# and it's use in the industry. I have full access to SharePoint Designer and I have Visual Studio 2008.

1) How can I implement simple c# code on SharePoint web page?

2) How to import and use c# classes on SharePoint page?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Page Language="C#" %>
<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 4</title>
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<SharePoint:CssRegistration Name="default" runat="server"/>
</head>

<body>

<form id="form1" runat="server">
</form>

</body>

</html>

This is a brand new, empty .ASPX page generated by "SharePoint Designer". How can I import and display simple "Hello World", c# code on it?

Thank you very much in advance

Vadims Samsinovs
  • 114
  • 1
  • 12

2 Answers2

0

Inside your <form> tag, insert this line:

<form id="form1" runat="server">
   <% Response.Write("Hello World"); %>
</form>

Have fun learning C#

ilovebigmacs
  • 983
  • 16
  • 28
0

You cannot run server-side scripts on your ASP.NET pages in SharePoint online. It is not allowed and will tell you as much when you try to do this.

If you had an on-premises site, you could modify a setting in web.config to enable this, but that is beside the point.