# .NET and More > ASP.NET And ASP.NET Core >  [RESOLVED] ASP, C# Question.

## DataMiser

I am working on some code that was originally written by someone else.
Below is a sample of what one of the file look like. Of course there is much more in the main body of the code but for purposes of this question this should be enough.


```
<%@ Page Language="C#" Debug="true" %>
<%@Import Namespace="System.Data" %>
<%@Import Namespace="System.Data.OleDb" %>
<%@Import Namespace="System.IO" %>
<%@Import Namespace="System.Text" %>

<%	
	Response.Write("Test");			
%>
```

My issue is that I want to add one or more functions that are called from the main body of this code and I can't figure out how to do it properly. 
This aspx file is called from some javascript in an html page, does some processing and returns some data back to the page.

For starters I want to add a logging function but all my attempts have failed.

So the question is can I add a function to this file somehow and have it called from the main body? If not then is there a way I can have the functions in another script file and call them from the main body? 

Any link or working example would be very helpful.

----------


## DataMiser

Looks like I figured it out.

TestMe.aspx


```
<%@ Page Language="C#" Debug="true" CodeFile="testme.aspx.cs" Inherits="TestMe"%>
<%@Import Namespace="System.Data" %>
<%@Import Namespace="System.Data.OleDb" %>
<%@Import Namespace="System.IO" %>
<%@Import Namespace="System.Text" %>

<%	
	Response.Write("Test");	
	Func1();
	
%>
```

TestMe.aspx.cs


```
using System;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Text;
public partial class TestMe : System.Web.UI.Page
{
    public void Func1(){
        Response.Write("Function 1");
        return;
    }
}
```

This appears to work properly

----------

