views:

398

answers:

2

Hello everyone,

I am using SharePiont Server 2007 Enterprise with Windows Server 2008 Enterprise. I am developing using VSTS 2008 + C# + .Net 3.5. I want to add some C# code to default.aspx (more details, adding some logics to Page_Load method of default.aspx) and its code behind file. But I did not find default.aspx and its code behind file on disk? Where are they and how to modify?

BTW: another solution is to create a default.aspx file and its related code behind file by myself? But in this situation how to borrow the existing content/UI from current default.aspx (I am satisfied with current content/UI of default.aspx)?

I am not sure which solution is better and easier in my requirement to add C# code to Page_Load. Any advice or guides?

thanks in advance, George

+1  A: 

What kind of functionality are you trying to add and is this a publishing page or part of a standard WSS site?

EDIT

Check out Andrew Connell's article on MSDN :-)

http://msdn.microsoft.com/en-us/library/bb986729.aspx

IrishChieftain
I want to deal with some http request information (e.g. log, redirect) in Page_Load. No UI code, all code are business logics. I am using publishing portal template of SharePoint, so it should be a publishing page (corret me if I am wrong)? The default.aspx is from a root site collection of template publishing portal of a standard WSS site. Any ideas how to add code to Page_Load?
George2
Thanks for your edit! My new issue is, when I open SharePoint designer 2007 to open default.aspx with Edit PageLayout option, welcomesplash.aspx apprears, I am confused that why welcomesplash.aspx apprears when I select edit page layout for default.aspx?
George2
First off, you shouldn't use SD 2007 for regular coding tasks. There are exception to this, but either way you should end up with your code in VS and go from there to packaging and deploying as a Feature. Read up on customized versus uncustomized pages and then study up on Features. If you deploy using SD 2007, your code changes could get overwritten as part of updates/sp's, etc.
IrishChieftain
Thanks, question answered!
George2
+1  A: 

Just a thought. How about creating a UI-less web part and adding it to the page ?

Leonidius