rmicone
asked on
How to convert Sharepoint Console Applications to Web Applicationss or ASP .Net pages
Environment = WSS 3.0 sp2, Windows 2003 sp2, Visual Studio 2008.
I have 5 scripts that I've written in Visual Studio 2008 as console applications that I want to convert or port to a version that can be loaded in an .aspx page.
Right now the console applications basically are reading list information in various ways and exporting to CSV format, through scheduled tasks in windows. I would like to have pages that could be called/loaded and do this process and deliver the CSV file to them.
Does anyone have a quick way to convert these to web pages .aspx files or perhaps some web resources that can point me in the right direction? Do I have to write a web service (sounds complicated and my first forays into that were time consuming)... any help would be appreciated
I have 5 scripts that I've written in Visual Studio 2008 as console applications that I want to convert or port to a version that can be loaded in an .aspx page.
Right now the console applications basically are reading list information in various ways and exporting to CSV format, through scheduled tasks in windows. I would like to have pages that could be called/loaded and do this process and deliver the CSV file to them.
Does anyone have a quick way to convert these to web pages .aspx files or perhaps some web resources that can point me in the right direction? Do I have to write a web service (sounds complicated and my first forays into that were time consuming)... any help would be appreciated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should be able to use VS or SPD.
Can you check your SharePoint logs in case there's anything to suggest what the problem is?
Can you check your SharePoint logs in case there's anything to suggest what the problem is?
ASKER
I'm getting :
08/23/2010 12:04:14.74 w3wp.exe (0x0550) 0x01F0 Windows SharePoint Services General 8dzz High Exception Type: System.Web.HttpCompileExce ption Exception Message: c:\WINDOWS\Microsoft.NET\F ramework\v 2.0.50727\ Temporary ASP.NET Files\root\9ef2dd1b\e1b1f8 b\App_Web_ tooltest2. aspx.a1088 71c.vttdyx _y.0.cs(15 4): error CS1518: Expected class, delegate, enum, interface, or struct
my code is below, i tried your code, same error, so I'm just using the default code that is included when you create a new .aspx page in vs2008 for the html
thanks for your help, let me know
08/23/2010 12:04:14.74 w3wp.exe (0x0550) 0x01F0 Windows SharePoint Services General 8dzz High Exception Type: System.Web.HttpCompileExce
my code is below, i tried your code, same error, so I'm just using the default code that is included when you create a new .aspx page in vs2008 for the html
thanks for your help, let me know
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.Utilities" %>
<%@ Import Namespace="Microsoft.SharePoint.WebPartPages" %>
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<script runat="server">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
protected void btnApply_Click(object sender, EventArgs e)
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
// your code goes here
Response.Write("success<br/>");
}
}
}
</script>
<html dir="ltr">
<head runat="server">
<META name="WebPartPageExpansion" content="full">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled 1</title>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>
ASKER
ok i got it, there was a extra } in there, this works, thank you for the help! corrected code attached
<%@ Page Language="C#" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="Microsoft.SharePoint.Utilities" %>
<%@ Import Namespace="Microsoft.SharePoint.WebPartPages" %>
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<script runat="server">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
protected void btnApply_Click(object sender, EventArgs e)
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
// your code goes here
Response.Write("success<br/>");
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnApply" runat="server" OnClick="btnApply_Click" Text="Apply" />
test1
</div>
</form>
</body>
</html>
ASKER