I'm such an old fuddy duddy... that I'd never really tried COM wrapping on C# objects.
But today all that changed...
This blog post helped lots:
http://blog.ianchivers.com/wordpress/?p=22
I'll try to actually post the code on this later... it's a nice way of extending a web app in an Intranet environment (it's not for Internet...)
Blog Pages
▼
Friday, September 25, 2009
Saturday, September 12, 2009
An excellent explanation of the confusion that reigns between ASP.Net 2.0 and 3.x
This is something I've come across more than once now - people complaining their ASP.Net 3.5 applications are running as 2.0 and not being able to set them in IIS...
Here's a superb explanation of what 3.0 and 3.5 added to 2.0 - and how they did it without changing the core runtime
http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx
Here's a superb explanation of what 3.0 and 3.5 added to 2.0 - and how they did it without changing the core runtime
http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx
Monday, September 07, 2009
Adding direct SQL editing/browsing access to any website...
I was editing a nopcommerce website that I only had http and ftp access to - no sql access.
So I needed a way to execute some SQL scripts.
To do this I added (to the administration pages) the following
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SQLRunner.aspx.cs" MasterPageFile="~/Administration/main.master" Inherits="NopSolutions.NopCommerce.Web.Administration.SQLRunner" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="server">
SQL:
<br />
<asp:TextBox ID="tbSQL" runat="server" Columns="80" Rows="10" TextMode="MultiLine">
</asp:TextBox>
<br />
<asp:CheckBox ID="cbScript" runat="server" Text="Run as script" />
<asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_OnClick" />
<br />
<asp:Panel ID="pnlOutput" runat="server" Visible="false">
<asp:GridView ID="grdResults" runat="server"></asp:GridView>
</asp:Panel>
<asp:Label ID="lblResult" runat="server" >
</asp:Label>
</asp:Content>
coupled with this source
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NopSolutions.NopCommerce.Web;
using NopSolutions.NopCommerce.DataAccess;
using System.Configuration;
using System.Data.SqlClient;
namespace NopSolutions.NopCommerce.Web.Administration
{
public partial class SQLRunner : BaseNopAdministrationPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnGo_OnClick(object sender, EventArgs e)
{
try
{
var sqlConnection = NopSqlDataHelper.CreateConnection(ConfigurationManager.ConnectionStrings["NopSqlConnection"].ConnectionString);
var sqlCommand = sqlConnection.GetSqlStringCommand(tbSQL.Text);
if (cbScript.Checked)
{
sqlConnection.ExecuteNonQuery(sqlCommand);
pnlOutput.Visible = false;
}
else
{
var dataSet = sqlConnection.ExecuteDataSet(sqlCommand);
pnlOutput.Visible = true;
grdResults.DataSource = dataSet;
grdResults.DataBind();
}
lblResult.Text = "OK";
}
catch (Exception exc)
{
lblResult.Text = string.Format("Exception seen - {0} - {1}", exc.GetType().Name, exc.Message);
}
}
}
}
Seems to work OK :)
So I needed a way to execute some SQL scripts.
To do this I added (to the administration pages) the following
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SQLRunner.aspx.cs" MasterPageFile="~/Administration/main.master" Inherits="NopSolutions.NopCommerce.Web.Administration.SQLRunner" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="server">
SQL:
<br />
<asp:TextBox ID="tbSQL" runat="server" Columns="80" Rows="10" TextMode="MultiLine">
</asp:TextBox>
<br />
<asp:CheckBox ID="cbScript" runat="server" Text="Run as script" />
<asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_OnClick" />
<br />
<asp:Panel ID="pnlOutput" runat="server" Visible="false">
<asp:GridView ID="grdResults" runat="server"></asp:GridView>
</asp:Panel>
<asp:Label ID="lblResult" runat="server" >
</asp:Label>
</asp:Content>
coupled with this source
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NopSolutions.NopCommerce.Web;
using NopSolutions.NopCommerce.DataAccess;
using System.Configuration;
using System.Data.SqlClient;
namespace NopSolutions.NopCommerce.Web.Administration
{
public partial class SQLRunner : BaseNopAdministrationPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnGo_OnClick(object sender, EventArgs e)
{
try
{
var sqlConnection = NopSqlDataHelper.CreateConnection(ConfigurationManager.ConnectionStrings["NopSqlConnection"].ConnectionString);
var sqlCommand = sqlConnection.GetSqlStringCommand(tbSQL.Text);
if (cbScript.Checked)
{
sqlConnection.ExecuteNonQuery(sqlCommand);
pnlOutput.Visible = false;
}
else
{
var dataSet = sqlConnection.ExecuteDataSet(sqlCommand);
pnlOutput.Visible = true;
grdResults.DataSource = dataSet;
grdResults.DataBind();
}
lblResult.Text = "OK";
}
catch (Exception exc)
{
lblResult.Text = string.Format("Exception seen - {0} - {1}", exc.GetType().Name, exc.Message);
}
}
}
}
Seems to work OK :)
Some interesting projects on codeplex
Just did a quick troll through the list of some of the more popular projects on codeplex - just to see what was on there.
These are some of the things that caught my eye.
Cosmos - open source operating system for C# - http://www.codeproject.com/KB/system/CosmosIntro.aspx http://www.gocosmos.org/Screenshots/index.EN.aspx
GPS Tracka - http://gpstracka.codeplex.com/ - looks good!
TravelPoint - windows mobile GPS location - http://travelpoint.codeplex.com/
Silverlight Media Player - http://xliteplayer.codeplex.com/
Quick Query Editor - http://q2.codeplex.com/
A bit DNN Help desk module - http://adefhelpdesk.codeplex.com/
Some DNN SKins - http://osdnnskins.codeplex.com/Wiki/View.aspx?title=Cash&referringTitle=Home
BugTracker.Net - http://btnet.codeplex.com/ and http://ifdefined.com/bugtrackernet.html
CSharp Parser - http://csparser.codeplex.com/
Code review - http://teamreview.codeplex.com/
Kigg - interesting site - http://kigg.codeplex.com/ and http://pimpthisblog.com/
CMS stuff - http://www.kooboo.com/docdetail/quick_start - http://kooboo.codeplex.com/
CMS stuff - http://www.jmdcms.com/
CMS - http://mojoportal.codeplex.com/
CRM project - http://crm.codeplex.com/
WikiPlex - http://wikiplex.codeplex.com/
DinnerNow sample app - http://dinnernow.codeplex.com/
Google Map control - http://googlemap.artembg.com/map/CaptureClick.aspx and http://googlemap.codeplex.com/
Geo Framework - http://geoframework.codeplex.com/
Deep Earth - Silverlight mapping - http://deepearth.codeplex.com/
Google maps in winforms - http://greatmaps.codeplex.com/
These are some of the things that caught my eye.
Cosmos - open source operating system for C# - http://www.codeproject.com/KB/system/CosmosIntro.aspx http://www.gocosmos.org/Screenshots/index.EN.aspx
GPS Tracka - http://gpstracka.codeplex.com/ - looks good!
TravelPoint - windows mobile GPS location - http://travelpoint.codeplex.com/
Silverlight Media Player - http://xliteplayer.codeplex.com/
Quick Query Editor - http://q2.codeplex.com/
A bit DNN Help desk module - http://adefhelpdesk.codeplex.com/
Some DNN SKins - http://osdnnskins.codeplex.com/Wiki/View.aspx?title=Cash&referringTitle=Home
BugTracker.Net - http://btnet.codeplex.com/ and http://ifdefined.com/bugtrackernet.html
CSharp Parser - http://csparser.codeplex.com/
Code review - http://teamreview.codeplex.com/
Kigg - interesting site - http://kigg.codeplex.com/ and http://pimpthisblog.com/
CMS stuff - http://www.kooboo.com/docdetail/quick_start - http://kooboo.codeplex.com/
CMS stuff - http://www.jmdcms.com/
CMS - http://mojoportal.codeplex.com/
CRM project - http://crm.codeplex.com/
WikiPlex - http://wikiplex.codeplex.com/
DinnerNow sample app - http://dinnernow.codeplex.com/
Google Map control - http://googlemap.artembg.com/map/CaptureClick.aspx and http://googlemap.codeplex.com/
Geo Framework - http://geoframework.codeplex.com/
Deep Earth - Silverlight mapping - http://deepearth.codeplex.com/
Google maps in winforms - http://greatmaps.codeplex.com/
Thursday, September 03, 2009
ASP.Net AJAX problems - Gray Google Maps
While adding some google map functionality to a custom nopcommerce build I came across some "gray map of death" problems with the gmaps. Basically the maps seemed to be offline - they didn't draw properly and they didn't respond correctly to mouse events (double click or drag).
Searching, I found a few references to these sorts of problems - most of which seemed to be caused by css issues (float:left seemed to be a common cause).
However, eventually this thread showed me the way forwards - http://www.reimers.dk/forums/thread/1251.aspx.
Basically, the initialisation of my AJAX tabs was causing the google map to lose its positional information - so to reset it I needed to call map.checkResize() - which seemed to cure the problem :)
Searching, I found a few references to these sorts of problems - most of which seemed to be caused by css issues (float:left seemed to be a common cause).
However, eventually this thread showed me the way forwards - http://www.reimers.dk/forums/thread/1251.aspx.
Basically, the initialisation of my AJAX tabs was causing the google map to lose its positional information - so to reset it I needed to call map.checkResize() - which seemed to cure the problem :)