I must say, I missed out on the Web 2.0 social networking scene. Is it just ME? I was hanging with some speakers at the Grand Rapids Day of .NET Friday evening, I was amazed the amount of discussion on twitter. Dan Hounshell mentioned the speaker badge has a spot for a twitter ID, well I have one now. It's SteveSchofield so join my network now.
I would be really curious to here from people are on twitter and were skeptical at first then transformed to a 'twitter' nut.
I'll be speaking at Grand Rapids, MI Day of .NET on IIS 7 for Developers.
'Session sign-up
http://www.wmdotnet.org/dodn08/
'Here is the list of sessions
http://dodn.bruceabernethy.com/Session.mvc.aspx/All
See you there,
Steve Schofield
Microsoft MVP - IIS
I'm having too much fun thinking of the old days of Classic ASP. Here is an example of using a Classic ASP page along with IIS 7.0 and Access 2007. PS: The example shows how to get it working, it's not meant to be production ready, you should add error coding to block sql injection attacks and other 'bad' things that can happen.
Here is the sample code.
Download here
<%
' create conn as adodb.connection and open it
dim strconn
dim conn
dim rs
strconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("App_Data\authors.accdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
sql = "select * from Authors"
set rs = conn.execute(sql)
%>
<html>
<head><title></title>
</head>
<body>
<table border="1">
<%
do while not rs.eof
response.write "<tr><td><b>" & rs("Field1") & "</td><td>" & rs("Field2") & "<td></tr>"
rs.movenext
loop
conn.close
Set conn = nothing
set rs = nothing
%>
</table>
</body>
</html>
I don't get a chance to write webpage code very often, but in my early days of doing samples, it was common to use an Access database. Access 2007 is the latest version available. The drivers weren't installed on my Windows Server 2008 server when I was trying to run an example. I got the following error.
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
A quick search found the add-on, the link is listed below. I don't recommend using Access for medium or higher volume applications, SQL Server or another database is appropriate. This was a fun exercise and I wanted to share my experience. Hope this helps.
2007 Office System Driver: Data Connectivity Components
-----------------
http://www.microsoft.com/downloads/thankyou.aspx?familyId=7554f536-8c28-4598-9b72-ef94e038c891&displayLang=en
My sample
-----------------
http://iislogs.com/articles/access2007/authors.aspx
Download the code
-----------------
http://iislogs.com/articles/access2007/authors.zip
Sample Code
-----------------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="authors.aspx.vb" Inherits="_IISLogscom" %>
<!DOCTYPE html PUBLIC "-//W3C//D
TD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Field1" HeaderText="First name"
SortExpression="Field1" />
<asp:BoundField DataField="Field2" HeaderText="Last name"
SortExpression="Field2" />
<asp:BoundField DataField="Field3" HeaderText="Book Title"
SortExpression="Field3" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT [ID], [Field1], [Field2], [Field3] FROM [Authors]">
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
Code Behind
-----------------
Partial Class _IISLogscom
Inherits System.Web.UI.Page
End Class
Web.config file
-----------------
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source="/App_Data/authors.accdb"" providerName="System.Data.OleDb" />
</connectionStrings>
</configuration>
Cheers,
Steve Schofield
Microsoft MVP - IIS
One of my favorite features in IIS 7.0 is shared configuration. It makes setting up and maintaining a web-farm a piece of cake. Here are some articles I found on the topic.
Shared configuration
http://learn.iis.net/page.aspx/264/shared-configuration/
Introduction
http://learn.iis.net/page.aspx/211/shared-configuration/
Configuring a Web Farm Using IIS Shared Configuration
http://learn.iis.net/page.aspx/453/configuring-a-web-farm-using-iis-shared-configuration/
My post will not get as much press as Slashdot, but here is some postings from sources at MS, including Bill Staples on the SQL Injection attacks that help clarify things.
Here is a post on forums.iis.net about this topic
http://forums.iis.net/t/1148917.aspx?PageIndex=1
For those who want to use Log parser to detect in your IISLogs if you've been hit, here are a few log parser examples.
'This will find all webpages that had sql injection. You can change the wording between the %% to look for a different string
logparser -i:iisw3c "select date,time,cs-uri-stem,cs-uri-query from <example.com> where cs-uri-query like '%CAST%'" -o:csv
'This will give you the first time your site was hit, if applicable.
logparser -i:iisw3c "select date,time,cs-uri-stem,cs-uri-query from <example.com> where cs-uri-query like '%1.js%'" -o:csv
'Download Log Parser 2.2
http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1287
Hope this helps,
Steve Schofield
Microsoft MVP - IIS
If you are an MVP, I'll be in Seattle / Redmond staying at the Sheraton for the 2008 MVP summit. See you there!
Steve Schofield
Microsoft MVP - IIS
Here is a script to pull all Windows Server 2008 servers out of your Active Directory and log to a text file. Just change the LDAP string.
Const ADS_SCOPE_SUBTREE = 2
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"SELECT Name FROM 'LDAP://DC=example,DC=com' WHERE objectClass='computer' " & _
"and operatingSystemVersion = '6.0 (6001)'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
LogInfo objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop
set objCommand = Nothing
set objRecordset = Nothing
set objConnection = Nothing
' ---------------------------------------------------------------------------------------
' | Loginfo |
' ---------------------------------------------------------------------------------------
Sub LogInfo(strResult)
dim objFile, fso2
objFile = "output.txt"
If fso.FileExists(objFile) Then
Set objFile = fso.OpenTextFile(objFile, 8)
objFile.WriteLine strResult
Else
Set objFile = fso.CreateTextFile(objFile, True)
objFile.WriteLine strResult
End If
objFile.close
Err.clear
End Sub
More Posts
Next page »