Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Deploying WebForm
Options
-
13-06-2006 3:04pmI am writing an event management website for my company and keep hitting my head off a brick wall!
I am using VS2005 (Visual Web Dev & vbscript) to create a page that takes data such as dates,times and ad-hoc requests and creates a wordfile and is sent to the required users as an attachment (using Outlook 2003 exchange server). This is working fine on both my localhost and the server.
Next I want to send a meeting request/calendar entry to the required users. This is working fine on my localhost but when deployed on the server (IIS 6.0) I keep getting the following error
"
System.Exception: Cannot create ActiveX component
.
..
Line 219: objOExp = CreateObject("Outlook.Application")
"
I have allowed permissions on system32 & Office11 folders, the correct .dlls are present but it still persists!
Any help would be appreciated0
Comments
-
I know your say the DLL's are present, but are they in the exact same path as on your localhost? As a test, you could make a copy of all referenced files and put em into your bin folder, then reference them from the bin folder.
EDIT: I don't know if i like the sound of granting any kind of access to the system32 folder0 -
Could you post the code for the webform?0
-
Here is the code as requested;
<%@ Page Language="VB" Debug ="true"%>
<%@ Import Namespace="System.Reflection" %>
<script runat="server">
Dim objDT As System.Data.DataTable
Dim objDR As System.Data.DataRow
Private Sub Page_Load(ByVal s As Object, ByVal e As EventArgs)
If Not IsPostBack Then 'if page is not posted back
makeUserInfo() 'then the makeUserInfo function
End If
End Sub
Function makeUserInfo()
objDT = New System.Data.DataTable("UserInfo")
objDT.Columns.Add("ID", GetType(Integer))
objDT.Columns("ID").AutoIncrement = True
objDT.Columns("ID").AutoIncrementSeed = 1
objDT.Columns.Add("Begin Date", GetType(String))
objDT.Columns.Add("Begin Time", GetType(String))
objDT.Columns.Add("End Date", GetType(String))
objDT.Columns.Add("End Time", GetType(String))
objDT.Columns.Add("Event Title", GetType(String))
objDT.Columns.Add("Location", GetType(String))
objDT.Columns.Add("Event Description", GetType(String))
objDT.Columns.Add("Link", GetType(String))
objDT.Columns.Add("Event Owner", GetType(String))
objDT.Columns.Add("Email", GetType(String))
objDT.Columns.Add("Type of Activity", GetType(String))
objDT.Columns.Add("Services", GetType(String))
objDT.Columns.Add("Other", GetType(String))
objDT.Columns.Add("Support Staff", GetType(String))
objDT.Columns.Add("Event Status", GetType(String))
objDT.Columns.Add("Number of Attendees", GetType(String))
objDT.Columns.Add("Recurrence", GetType(String))
Session("UserInfo") = objDT
End Function
Sub AddToUserInfo(ByVal s As Object, ByVal e As EventArgs)
pnlSubmit.Visible = True
objDT = Session("UserInfo")
objDR = objDT.NewRow
objDR("Begin Date") = txtBdate.Text
objDR("Begin Time") = txtBtime.Text
objDR("End Date") = txtEdate.Text
objDR("End Time") = txtEtime.Text
objDR("Event Title") = txtTitle.Text
objDR("Location") = ddlLocation.SelectedItem.Text
objDR("Event Description") = txtDescription.Text
objDR("Link") = txtLink.Text
objDR("Event Owner") = txtOwner.Text
objDR("Email") = txtEmail.Text
objDR("Type of Activity") = ddlActivity.SelectedItem.Text
objDR("Services") = lblServices.Text
objDR("Other") = txtOther.Text
objDR("Support Staff") = cblStaff.SelectedItem.Text
objDR("Event Status") = ddlEvents.SelectedItem.Text
objDR("Number of Attendees") = txtNumber.Text
objDR("Recurrence") = rdlRecurrence.SelectedItem.Text
objDT.Rows.Add(objDR)
Session("UserInfo") = objDT
dg.DataSource = objDT
dg.DataBind()
End Sub
Sub Delete_Item(ByVal s As Object, ByVal e As DataGridCommandEventArgs)
objDT = Session("UserInfo")
objDT.Rows(e.Item.ItemIndex).Delete()
Session("UserInfo") = objDT
dg.DataSource = objDT
dg.DataBind()
End Sub
Protected Sub cmdBatch_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim append As Boolean = False
Dim newFile As IO.File
Dim swText As IO.StreamWriter
Dim TextFile As String = ("C:\EMDoc\sample1.dot")
swText = newFile.CreateText(TextFile)
swText.Close()
Using sw = New IO.StreamWriter(TextFile, append)
sw.Write("The following detials have been submitted\n" & txtBdate.Text & "\n" & txtBtime.Text & "\n" & txtEdate.Text & "\n" & txtEtime.Text & "\n" & txtTitle.Text & "\n" & txtDescription.Text & "\n" & txtLink.Text & "\n" & txtOwner.Text & "\n" & ddlActivity.Text & "\n" & txtOther.Text & "\n" & cblServices.Text & "\n" & ddlEvents.Text & "\n" & txtNumber.Text & "\n" & rdlRecurrence.SelectedItem.Text)
sw.WriteLine("The following detials have been submitted:" & vbCrLf)
sw.WriteLine("Begin Date: " & txtBdate.Text & vbCrLf)
sw.WriteLine("Begin Time: " & txtBtime.Text & vbCrLf)
sw.WriteLine("End Date: " & txtEdate.Text & vbCrLf)
sw.WriteLine("End Time: " & txtEtime.Text & vbCrLf)
sw.WriteLine("Event Title: " & txtTitle.Text & vbCrLf)
sw.WriteLine("Location: " & ddlLocation.SelectedItem.Text & vbCrLf)
sw.WriteLine("Event Description: " & txtDescription.Text & vbCrLf)
sw.WriteLine("Link: " & txtLink.Text & vbCrLf)
sw.WriteLine("Event Owner: " & txtOwner.Text & vbCrLf)
sw.WriteLine("Email: " & txtEmail.Text & vbCrLf)
sw.WriteLine("Type of Actvity: " & ddlActivity.Text & vbCrLf)
sw.WriteLine("Services: " & lblServices.Text & vbCrLf)
sw.WriteLine("Other: " & txtOther.Text & vbCrLf)
sw.WriteLine("Support Staff: " = cblStaff.SelectedItem.Text & VCrLf)
sw.WriteLine("Event Status: " & ddlEvents.Text & vbCrLf)
sw.WriteLine("Number of Attendees: " & txtNumber.Text & vbCrLf)
sw.WriteLine("Recurrence: " & rdlRecurrence.Text & vbCrLf)
sw.Close()
End Using
Dim objMail As New Mail.MailMessage()
objMail.To = cblStaff.SelectedItem.Value
objMail.Cc = txtEmail.Text
objMail.From = "someone@domain.com"
'objMail.From = txtEmail.Text
objMail.BodyFormat = Mail.MailFormat.Text
objMail.Priority = Mail.MailPriority.High
objMail.Subject = "Test ASP.NET email"
objMail.Body = "This is a test-please discard any changes "
'the fields attribute was enabled by MS in .NET 1.1
objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 2)
Dim MyAttach As New Mail.MailAttachment("C:\EMDoc\sample1.dot")
objMail.Attachments.Add(MyAttach)
Mail.SmtpMail.SmtpServer = "exchange.server.domain.com"
'This works fine on local host but not on IIS remote
Mail.SmtpMail.Send(objMail)
Dim objOExp As Microsoft.Office.Interop.Outlook.Application
Dim objAppt As Microsoft.Office.Interop.Outlook.AppointmentItem
Const olAppointmentItem = 1
Const olMeeting = 1
Dim StartDate As DateTime = DateTime.Parse(txtBdate.Text)
Dim EndDate As DateTime = DateTime.Parse(txtEdate.Text)
'Dim StartTime As DateTime = DateTime.Parse(txtBtime.Text)
'Dim EndTime As DateTime = DateTime.Parse(txtEtime.Text)
Dim StartTime As String = txtBtime.Text
Dim EndTime As String = txtEtime.Text
objOExp = CreateObject("Outlook.Application")
objAppt = objOExp.CreateItem(olAppointmentItem)
With objAppt
.Subject = objMail.Subject
.Start = StartDate + " " + txtBtime.Text
.End = EndDate + " " + txtEtime.Text
.Location = ddlLocation.SelectedValue
.Subject = "New Event Requested"
.Body = "A new event is scheduled for " & txtBdate.Text _
& " Please Review"
.ReminderSet = True
.ReminderMinutesBeforeStart = 15
.MeetingStatus = olMeeting
.RequiredAttendess = "somwhere@domain.com"
.RequiredAttendees = cblStaff.SelectedValue
.RequiredAttendees = txtEmail.Text
.Send()
End With
objAppt = Nothing
objOExp = Nothing
End Sub
Protected Sub ddlActivity_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If ddlActivity.SelectedItem.Text = "Other" Then
pnlOther.Visible = True
End If
End Sub
Protected Sub cblServices_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim cbList As String = ""
Dim cb As ListItem
For Each cb In cblServices.Items
If cb.Selected Then
cbList += cb.Text + " "
End If
Next
If cbList = "" Then
lblServices.Text = "No item selected"
Else
lblServices.Text = "You selected " + cbList
End If
If cblServices.SelectedItem.Text = "Other" Then
pnlOther.Visible = True
End If
End Sub
Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
txtBdate.Text = Calendar1.SelectedDate.ToShortDateString()
txtEdate.Text = txtBdate.Text
End Sub
Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
txtEdate.Text = Calendar2.SelectedDate.ToShortDateString()
End Sub
Protected Sub ImageButton1_Click1(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Calendar1.Visible = True
End Sub
Protected Sub ImageButton2_Click1(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Calendar2.Visible = True
End Sub
</script>
Yet again any help would be much appreciated0 -
EthanCleary wrote:I am writing an event management website for my company and keep hitting my head off a brick wall!
I am using VS2005 (Visual Web Dev & vbscript) to create a page that takes data such as dates,times and ad-hoc requests and creates a wordfile and is sent to the required users as an attachment (using Outlook 2003 exchange server). This is working fine on both my localhost and the server.
Next I want to send a meeting request/calendar entry to the required users. This is working fine on my localhost but when deployed on the server (IIS 6.0) I keep getting the following error
"
System.Exception: Cannot create ActiveX component
.
..
Line 219: objOExp = CreateObject("Outlook.Application")
"
I have allowed permissions on system32 & Office11 folders, the correct .dlls are present but it still persists!
Any help would be appreciated
Is Outlook installed on the server/it's DLL's registered?
As Mutant_Fruit said, if any web application needs special access to the system32 folder it's [strike]badly written[/strike] not written very well.
BTW, there are cheap hosted solutions that have the functionality you require, without the hassle. Check out www.eventznet.ie for one (it's written in .NET too)
0
Advertisement