Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Saturday, March 31, 2012

System.Drawing.Drawing2D.GraphicsPath in ASP.Net

Hi,
Can I use GraphicsPath class in ASP.Net page? There's other way to do this?
thanks a lotEduardo Rosa wrote:

> Hi,
> Can I use GraphicsPath class in ASP.Net page? There's other way to do this
?
> thanks a lot
>
What's your goal?
//Rutger
You can create graphic images from any .NET code.
The question then becomes "what do you do with the image?"
In ASP.NET the most obvious thing would be to point an image control to it.
MyImageControl.ImageURL="myImage.gif"
or
MyIMageContro.ImageURL="myImageGeneratorPage.aspx"
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Eduardo Rosa" <eddr5000@.yahoo.com.br> wrote in message
news:e0mB7CGkEHA.1996@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Can I use GraphicsPath class in ASP.Net page? There's other way to do
> this?
> thanks a lot
>
thanks a lot, I was just curious...

System.Drawing.Drawing2D.GraphicsPath in ASP.Net

Hi,
Can I use GraphicsPath class in ASP.Net page? There's other way to do this?

thanks a lotEduardo Rosa wrote:

> Hi,
> Can I use GraphicsPath class in ASP.Net page? There's other way to do this?
> thanks a lot

What's your goal?

//Rutger
You can create graphic images from any .NET code.
The question then becomes "what do you do with the image?"
In ASP.NET the most obvious thing would be to point an image control to it.
MyImageControl.ImageURL="myImage.gif"
or
MyIMageContro.ImageURL="myImageGeneratorPage.aspx"

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Eduardo Rosa" <eddr5000@.yahoo.com.br> wrote in message
news:e0mB7CGkEHA.1996@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Can I use GraphicsPath class in ASP.Net page? There's other way to do
> this?
> thanks a lot
thanks a lot, I was just curious...

System.InvalidCastException

I have UI Page.aspx which has this class:
PAGE.ASPX
private class Blah
public bVar as boolean
end class
On page load this class is added to the collection ColBlah and sent to the
function in business layer which has identical class defined.
BusLayer.vb
private class Blah
bVar as boolean
end class
class BusLayer
Public function Process(oCol as collection)
dim oObject, oBlah as Blah
for each oObject in oCol
oBlah=CType(oObject,Blah)
next oCol
end class
the line oBlah=CType(oObject,Blah) generates the following exception
System.InvalidCastException
Why? Anybody?A class can't exist in two places at the same time. Just because they have
the same name and share all the same members, doesn't make them the same.
As far as .NET is concerned, you might as well be trying to cast a textbox
to a database connection.
This class should be defined in your business layer ONLY...and your aspx
page should create an instance of THAT class.
Karl
http://www.openmymind.net/
http://www.codebetter.com/
"Mike Kansky" <MikeKansky@.discussions.microsoft.com> wrote in message
news:8DD38BB8-E1A6-4C92-8629-918A5F3FAC83@.microsoft.com...
>I have UI Page.aspx which has this class:
> PAGE.ASPX
> private class Blah
> public bVar as boolean
> end class
>
> On page load this class is added to the collection ColBlah and sent to the
> function in business layer which has identical class defined.
> BusLayer.vb
> private class Blah
> bVar as boolean
> end class
> class BusLayer
> Public function Process(oCol as collection)
> dim oObject, oBlah as Blah
> for each oObject in oCol
> oBlah=CType(oObject,Blah)
> next oCol
> end class
> the line oBlah=CType(oObject,Blah) generates the following exception
> System.InvalidCastException
> Why? Anybody?
>

Wednesday, March 28, 2012

System.IO.File class and IP paths?

I try to use System.IO.File.Copy where the source is
"\\10.100.100.1\myfolder\test.txt"

When running the aspx file on the server (the server is
also the client) it works, but when using another NT
client it does not work.
The err.description says "Could not find file ..."
System.IO.File.Exists return false here.

But If I manually paste in \\10.100.100.1
\myfolder\test.txt in the IE address field and press "Go"
the file is found.

Strange or not?Hi,

I don't think that the default asp.net user got rights to access network
resources.

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Monday, March 26, 2012

system.net.mail

Hello

I am trying to develop a site and am currently working on a feedback form, requiring the use of the .net.mail Class. This is just a development running on the local ASP.Net development server on my P.C.. I have an I.S.P., with several email addresses and the smtp server name. (smtp.??.com). My operating system is Windows XP home (SP2). I have read so many threads and googled, I've seen many coding versions and config versions.

To test, I use one of my email addresses for the .from and another for the To. Today over a period of a couple of hours I sent 15 messages and only 4 were delivered. Now I can't get any response although if I mis-spell my To address, my I.S.P. system administrator returns it as undelivered. I can send a message and it appears to be sent (no exception caught) but it never arrives. I can send it again and the exception shows sending failed. I really don't know how to solve this.

Should I be able to test my feedback form under the above scenario.

Any specific help would be appreciated.

Chris

(using VisualBasic)

That might be a silly question, but just to be sure: would your ISP have some kind of server-side spam filter? Depending on the way you composed your test emails, mines almost invariably were getting caught in all manners of spam filters, and if its a server side one (aka: hosted by your ISP itself), you'd have no way to notice...

shados

Thanks for that. The I.S.P. Rep that I spoke to said that they "block" all emails that don't come from Outlook, Outlook Express and a couple of other email applications. (how or why, who knows?) I suppose what I wanted to know was that nothing was wrong with my coding and 4 succeeding out of 15, I hope suggests that. After my post I had a 4 out of 4 success run. Your experience does reassure me that that is the problem.

Many thanks.

Chris

System.Net.Mail

I have a class that contains(taken from faq section):

using System.Net.Mail;

public class MailHelper
{
/// <summary>
/// Sends an mail message
/// </summary>
/// <param name="from">Sender address</param>
/// <param name="to">Recepient address</param>
/// <param name="bcc">Bcc recepient</param>
/// <param name="cc">Cc recepient</param>
/// <param name="subject">Subject of mail message</param>
/// <param name="body">Body of mail message</param>

public static void SendMailMessage(string from, string to, string bcc, string cc, string subject, string body)
{
// Instantiate a new instance of MailMessage
MailMessage mMailMessage = new MailMessage();

// Set the sender address of the mail message
mMailMessage.From = new MailAddress(from);
// Set the recepient address of the mail message
//mMailMessage.To.Add(to);
//mMailMessage.To = new MailAddressCollection().Add(new MailAddress(to));

ERROR HERE: "Property or indexer 'System.Net.Mail.MailMessage.To' cannot be assisgned to--it is read only

mMailMessage.To = new MailAddressCollection().Add(to);

// Check if the bcc value is null or an empty string
if ((bcc != null) && (bcc != string.Empty))
{
// Set the Bcc address of the mail message
mMailMessage.Bcc.Add(new MailAddress(bcc));
}

// Check if the cc value is null or an empty value
if ((cc != null) && (cc != string.Empty))
{
// Set the CC address of the mail message
mMailMessage.CC.Add(new MailAddress(cc));
}

// Set the subject of the mail message
mMailMessage.Subject = subject;
// Set the body of the mail message
mMailMessage.Body = body;

// Secify the format of the body as HTML
mMailMessage.IsBodyHtml = true;
// Set the priority of the mail message to normal
mMailMessage.Priority = MailPriority.Normal;

// Instantiate a new instance of SmtpClient
SmtpClient mSmtpClient = new SmtpClient();
// Send the mail message
mSmtpClient.Send(mMailMessage);
}

I call the method from the Form Submit button Like this:

private void GenEmails()
{

//Email Code Executed On Click Event
string from = EmailTextBox.Text;
string to = ContactIdentifier.EmailAddress;
string bcc = "null";
string cc = "null";
string subject = subjectTextBox.Text;
string body = DescriptionTextBox.Text;

MailHelper.SendMailMessage(from, to, bcc, cc, subject, body);
}

All I'm trying to do is pass the textbox.text values into the method as parameters. What am I doing wrong here?

why don't you put just:

mMailMessage.To.Add(to);
//mMailMessage.To = new MailAddressCollection().Add(new MailAddress(to));

//ERROR HERE: "Property or indexer 'System.Net.Mail.MailMessage.To' cannot be assisgned to--it is read only

//mMailMessage.To = new MailAddressCollection().Add(to);

works for me...


// Set the recepient address of the mail message
//mMailMessage.To.Add(to);
//mMailMessage.To = new MailAddressCollection().Add(new MailAddress(to));

mMailMessage.To.Add(new MailAddress(to);

http://msdn2.microsoft.com/en-us/library/system.net.mail.mailmessage.to.aspx


Dim messageAsNew MailMessage("sender@.emailaddress.com", Session("destionationemailaddress"),"Order Alert","my e-mail body")

message.cc="sendanother@.emailaddresstothisaddress.com"

Dim emailClientAsNew SmtpClient("xxxxxxserver")

emailClient.Send(message)

when I add cc to the message object I get message.cc readonly error.

could you please help me with my problem.

thanks


use System.Web.Mail.MailMessage instead of System.Net.Mail.MailMessage.

System.Net.Mail class smtpdemo needs users address in message body from txt.emailAddress

I have this code behind from the new asp.net 2.0 System.Net.Mail class smtpdemo i am working with. It sends an HTML email to myself the from address and to the email address in txt.emailAddress as a CC. I am trying to get the txt.email address somewhere in the message body that it sends out. this code does not show the imputed contents of txt.emailaddress anywhere in the email so i canot reply to the sender. It declaires me as the sender and sends the person filing out the form an email. I need to declar the contents of txt.emailadress as a variable and call it in the message body. Ive tryed dozens of different ways but they all have errors. i hope someone can look at this code and show me how to get the users email address sent with the message.
/code/
Imports System.Net.Mail

PartialClass report_aspx

Inherits System.Web.UI.Page

ProtectedSub sendEmail_Click(ByVal senderAsObject,ByVal e _

As System.EventArgs)Handles sendEmail.Click

Dim sBodyAsString

Dim fileReaderBodyAsString

Dim fileReaderFormatAsString

Dim WebDirectoryAsString = Server.MapPath(".") &"\"

Dim fileNameAsString = WebDirectory

Dim htmlEmailFormatAsString = WebDirectory &"MailFormat.htm"

SelectCase Subject.Text

Case"Broken Link"

fileName = fileName &"BrokenLink.txt"

Case"Missing Picture"

fileName = fileName &"MissingPicture.txt"

Case"Typographical Error"

fileName = fileName &"TypoError.txt"

CaseElse

fileName = fileName &"other.txt"

EndSelect

fileReaderBody =My.Computer.FileSystem.ReadAllText(fileName)

fileReaderFormat =My.Computer.FileSystem.ReadAllText(htmlEmailFormat)

sBody = fileReaderFormat.Replace("BODYGOESHERE", _

messageBody.Text)

sBody = sBody.Replace("CONTENTGOESHERE", fileReaderBody)

sBody = sBody.Replace("SUBJECTGOESHERE", Subject.Text)

Dim toAddressAs MailAddress =New _

MailAddress(me@dotnet.itags.org.myemailaddress,"Webmaster")

Dim ccAddressAs MailAddress =New _

MailAddress(emailAddress.Text, emailName.Text)

Dim SenderAddressAs MailAddress =New _

MailAddress(emailAddress.Text)

Dim fromAddressAs MailAddress =New _

MailAddress(me@dotnet.itags.org.myemailaddress)

Dim eMailAs MailMessage =New _

MailMessage(fromAddress, fromAddress)

eMail.CC.Add(fromAddress)

eMail.Subject = Subject.Text

Dim htmlTypeAs System.Net.Mime.ContentType = _

New System.Net.Mime.ContentType("text/html")

Dim txtTypeAs System.Net.Mime.ContentType = _

New System.Net.Mime.ContentType("text/plain")

eMail.AlternateViews.Add( _

AlternateView.CreateAlternateViewFromString(sBody, htmlType))

eMail.AlternateViews.Add( _

AlternateView.CreateAlternateViewFromString(fileReaderBody & vbCrLf & messageBody.Text, htmlType))

Dim attchmentAs Attachment =New _

Attachment(WebDirectory &"goldbar.gif")

eMail.Attachments.Add(attchment)

Dim clientAs SmtpClient =New SmtpClient("myemailserver")

client.Send(eMail)

lblMessageSent.Text ="MESSAGE SENT"

emailAddress.Text =""

emailName.Text =""

messageBody.Text =""

EndSub

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

EndSub

EndClass
/end code/

I fixed my form by modifying the mailformat.htm page that I will place below and adding:

/codebehind file/
Body = sBody.Replace("NAMEGOESHERE", emailName.Text)

sBody = sBody.Replace("EMAILFROMGOESHERE", emailAddress.Text)
/end codebehind file/
/mailformat.html/

<html><body><h1>SUBJECTGOESHERE</h1><imgsrc="goldbar.gif"/><br/>BODYGOESHERE

<br/>

<imgsrc="goldbar.gif"/><br/>

NAMEGOESHERE<br/>

EMAILFROMGOESHERE<br/>

<br/>

<blockquote>CONTENTGOESHERE</blockquote></body></html>

Saturday, March 24, 2012

System.Net.WebClient Best Practices

I've used the WebClient class on a few projects but I wanted to know if
anyone could point to the good resource for Best Practices with this object.
The two things I haven't seen in sample code are:
1. How to retrieve connection error messages, such as a DNS resolution error
or connection dropped errors.
2. Should I use the Dispose or Finalize methods to destroy the object when I
done? I assume that the object uses unmanaged code at some point to connect
to another server. So do I need to use the Finalize method release those
other objects?
Here is a function from one of my projects:
Private Function getRemoteDat() As Boolean
Dim CCPostURL As String =
ConfigurationSettings.AppSettings("https://www.remoteData.com/process.asp")
Dim Status As Boolean = False ' Assumes failure until set to True
Dim ResponseResults As String
Dim responseString As String
Dim myWebClient As New System.Net.WebClient
Dim responseArray As Byte()
Dim myNameValueCollection As New
System.Collections.Specialized.NameValueCollection
Dim ResultMsg As String
Dim splitResponse() As String
myNameValueCollection.Add("first_name", txtBillFName.Text)
myNameValueCollection.Add("last_name", txtBillLName.Text)
myNameValueCollection.Add("address", txtBillAdd1.Text)
Try
responseArray = myWebClient.UploadValues(CCPostURL, "POST",
myNameValueCollection) 'Sends request to Gateway
responseString = System.Text.Encoding.ASCII.GetString(responseArray)
'Converts bit array to string
splitResponse = Split(responseString, System.Environment.NewLine)
'Splits response into string array
ResultMsg = splitResponse(1).Remove(0, 19) 'Gets Result Message
Catch
Status = False 'Connection failed or response was corrupted
End Try
If ResultMsg = "APPROVED" Then
_GatewayApprovalString = splitResponse(2) & "|" & splitResponse(3)
'Set string if successful
Status = True
Else
Status = False
End If
Return Status
End FunctionHi jmh,
Welcome to ASP.NET newsgroup.
Regarding on the "System.Net.WebClient Best Practices" you mentioned, here
are some of my suggestions:
The WebClient class in system.net namespace is a well-encapsulated class
which just simulate the IE browser's behavior. When we use it to post data
or retrieve response from remote url, it will help do the underlying
connection and transfering tasks for us(also some additinal works such as
cookie management). In fact, the WebClient class is using the
HttpWebRequest class internally when dealing with http... resource. So if
we need more detailed and
underlying control when doing such work, we can consider directly use the
HttpWebRequest class instead. This class can help us manually write binary
data into the http request's stream and customize the http Message's header
Also, we can get the http status code after we make request and retieve
response from the remote resource. For detailed reference on
HttpWebRequest , you can lookup the MSDN document on it(or the accessing
internet section in "programming with .net section).
In addition, since httpWebrequest have more underlying controls, it also
require us to do more works to properly handle the resource. for example,
we need to manually close the response stream after read it so as not to
occupy the connection. Here are some tech articles and former newsgroup
threads discussing on such problems, such as use httpwebrequest to post
data, upload file or upload files together with form datas:
#Send data from non browser client (using HttpWebRequest) that can be used
by access web page controls.
http://weblogs.asp.net/ngur/archive.../11/129951.aspx
#how to upload file via c# code
http://groups-beta.google.com/group...anguages.csharp
/browse_thread/thread/eea92e16a26fbdc0/474b6a3fcd63dd93?q=C%23+upload+file+s
teven+cheng&rnum=1&hl=en#474b6a3fcd63dd93
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

System.Net.WebClient Best Practices

I've used the WebClient class on a few projects but I wanted to know if
anyone could point to the good resource for Best Practices with this object.

The two things I haven't seen in sample code are:
1. How to retrieve connection error messages, such as a DNS resolution error
or connection dropped errors.
2. Should I use the Dispose or Finalize methods to destroy the object when I
done? I assume that the object uses unmanaged code at some point to connect
to another server. So do I need to use the Finalize method release those
other objects?

Here is a function from one of my projects:

Private Function getRemoteDat() As Boolean
Dim CCPostURL As String =
ConfigurationSettings.AppSettings("https://www.remoteData.com/process.asp")

Dim Status As Boolean = False ' Assumes failure until set to True
Dim ResponseResults As String
Dim responseString As String
Dim myWebClient As New System.Net.WebClient
Dim responseArray As Byte()
Dim myNameValueCollection As New
System.Collections.Specialized.NameValueCollection
Dim ResultMsg As String
Dim splitResponse() As String

myNameValueCollection.Add("first_name", txtBillFName.Text)
myNameValueCollection.Add("last_name", txtBillLName.Text)
myNameValueCollection.Add("address", txtBillAdd1.Text)

Try
responseArray = myWebClient.UploadValues(CCPostURL, "POST",
myNameValueCollection) 'Sends request to Gateway
responseString = System.Text.Encoding.ASCII.GetString(responseArray )
'Converts bit array to string
splitResponse = Split(responseString, System.Environment.NewLine)
'Splits response into string array
ResultMsg = splitResponse(1).Remove(0, 19) 'Gets Result Message
Catch
Status = False 'Connection failed or response was corrupted
End Try

If ResultMsg = "APPROVED" Then
_GatewayApprovalString = splitResponse(2) & "|" & splitResponse(3)
'Set string if successful
Status = True
Else
Status = False
End If

Return Status
End FunctionHi jmh,

Welcome to ASP.NET newsgroup.
Regarding on the "System.Net.WebClient Best Practices" you mentioned, here
are some of my suggestions:

The WebClient class in system.net namespace is a well-encapsulated class
which just simulate the IE browser's behavior. When we use it to post data
or retrieve response from remote url, it will help do the underlying
connection and transfering tasks for us(also some additinal works such as
cookie management). In fact, the WebClient class is using the
HttpWebRequest class internally when dealing with http... resource. So if
we need more detailed and
underlying control when doing such work, we can consider directly use the
HttpWebRequest class instead. This class can help us manually write binary
data into the http request's stream and customize the http Message's header
Also, we can get the http status code after we make request and retieve
response from the remote resource. For detailed reference on
HttpWebRequest , you can lookup the MSDN document on it(or the accessing
internet section in "programming with .net section).

In addition, since httpWebrequest have more underlying controls, it also
require us to do more works to properly handle the resource. for example,
we need to manually close the response stream after read it so as not to
occupy the connection. Here are some tech articles and former newsgroup
threads discussing on such problems, such as use httpwebrequest to post
data, upload file or upload files together with form datas:

#Send data from non browser client (using HttpWebRequest) that can be used
by access web page controls.
http://weblogs.asp.net/ngur/archive.../11/129951.aspx

#how to upload file via c# code
http://groups-beta.google.com/group...anguages.csharp
/browse_thread/thread/eea92e16a26fbdc0/474b6a3fcd63dd93?q=C%23+upload+file+s
teven+cheng&rnum=1&hl=en#474b6a3fcd63dd93

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

System.Nullreference Exception

i have written the following code to call a method in a class like

in the aspx.cs page
List<string> surls = new List<string>();

Cweb.GetMainUrls(document,ref surls);
Response.Write(surls);

in the Cweb Class page the coding is like

public static void GetMainUrls(Htmldocument doc,ref List<string> urls)
{
//Some functionalities
}

i get the following error when i run the application like

System.NullReference Exception
object reference not set to an instance

so because of this error my method is not getting called from the class and hence no result

can anyone help me out in finding like why my method was not called

i google through several sites and found that
this may be due to the fact that the "surls" are null and hence the method was not called
i dont follow these sequence

so anybody plz help me on this regard
thanks
Rama

System.NullReference Exception means you have referred an object, while this object is not instantialized.
object reference not set to an instance"this may be due to the fact that the "surls" are null and hence the method was not called " --> i think it's probablely because of that. So, set a break point there and debug. then see what the value of urls is. (well, response.write maybe a easier way to do that)

Hope my suggestion helps :)

System.NullReferenceException

Hi,

Can somebody tell me how I get this error?

here is a snippet of the code:

<span class="Normal">
<asp:Label runat="Server" Text='<%# DataBinder.Eval(Container.DataItem,"CreatedByUser") %>' ID="Label1"/>
</span>
<% if (Context.User.Identity.Name == Label1.Text) { %>
<asp:HyperLink id="editLink" ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditAnnouncements.aspx?ItemID=" + DataBinder.Eval(Container.DataItem,"ItemID") + "&mid=" + ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
<% } %>
<span class="ItemTitle">
<%# DataBinder.Eval(Container.DataItem,"Title") %>
</span
and here is the compiler error:

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Line 9: <asp:Label runat="Server" Text='<%# DataBinder.Eval(Container.DataItem,"CreatedByUser") %>' ID="Label1"/>
Line 10: </span>
Line 11: [RED MARKED]<% if (Context.User.Identity.Name == Label1.Text) { %>[\RED MARKED]
Line 12: <asp:HyperLink id="editLink" ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditAnnouncements.aspx?ItemID=" + DataBinder.Eval(Container.DataItem,"ItemID") + "&mid=" + ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
Line 13: <% } %
Hope you can help me

regards

delleNullReferenceException's usually occur (in my experience anyway) when you have programmed an event to occur and presumed a variable/data source will be available and (for one of many possible reasons) it isn't.

I see you are using a databound control - have you told the control where to get it's data from? have called the DataBind event of the control?

Could you give us a bit more code?
Which line in the code is it telling you is causing this error?
You have to check Context.User for null before use
Hi,
Now I'm checking the value "Context.User.Identity.Name" for "null".

This was one problem I guess, because now I can build the project without an error,
but when I log in I still become an error.
I replaced my variables with constants to see if the function would work, and yes it is working.
The problem is that the value of Label1.Text cannot be compared with "Context.User.Identity.Name" for some reason.

Here is the new code:
<span class="Normal">
<%# DataBinder.Eval(Container.DataItem,"CreatedByUser") %>
<asp:Label runat="Server" Text='<%# DataBinder.Eval(Container.DataItem,"CreatedByUser") %>' ID="Label1"/>
</span>
<% if (Context.User.Identity.Name != "") { %>
<% if (Context.User.Identity.Name == Label1.Text) { %>
<asp:HyperLink id="editLink" ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditAnnouncements.aspx?ItemID=" + DataBinder.Eval(Container.DataItem,"ItemID") + "&mid=" + ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
<% } %>
<% } %>
<span class="ItemTitle">
<%# DataBinder.Eval(Container.DataItem,"Title") %>
</span
The error the compiler gives me is still the same in line 12:

Line 10: </span>
Line 11: <% if (Context.User.Identity.Name != "") { %>
Line 12: <% if (Context.User.Identity.Name == Convert.ToString(Label1.Text)) { %>
Line 13: <asp:HyperLink id="editLink" ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditAnnouncements.aspx?ItemID=" + DataBinder.Eval(Container.DataItem,"ItemID") + "&mid=" + ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
Line 14: <% } %
Suggestions would be very appreciated.
thx.

Tuesday, March 13, 2012

System.Runtime.InteropServices.COMException: Class not registered

Hello,
I'm trying to develop an ASP.NET application that uses a third-party COM
dll. I've added a reference to the dll in the web app project along with
adding a "using" directive in the code-behind (referencing the COM
namespace). Every time I try and run the application and call methods on th
e
COM object, I get the following error:
System.Runtime.InteropServices.COMException: Class not registered
I've successfully registered the dll using regsvr32 and added
the AspCompat="true" directive on the Page, but doesn't seem to help.
I'd really appreciate any suggestions on how to remedy this problem.
Thanks for your time.
DonnieAre u using VS.NET?
"Donnie" <Donnie@.discussions.microsoft.com> wrote in message
news:2A43630B-C5AE-4AC7-9656-EA496352E760@.microsoft.com...
> Hello,
> I'm trying to develop an ASP.NET application that uses a third-party COM
> dll. I've added a reference to the dll in the web app project along with
> adding a "using" directive in the code-behind (referencing the COM
> namespace). Every time I try and run the application and call methods on
the
> COM object, I get the following error:
> System.Runtime.InteropServices.COMException: Class not registered
> I've successfully registered the dll using regsvr32 and added
> the AspCompat="true" directive on the Page, but doesn't seem to help.
> I'd really appreciate any suggestions on how to remedy this problem.
> Thanks for your time.
> Donnie
>

System.Runtime.InteropServices.COMException: Class not registered

Hello,
I'm trying to develop an ASP.NET application that uses a third-party COM
dll. I've added a reference to the dll in the web app project along with
adding a "using" directive in the code-behind (referencing the COM
namespace). Every time I try and run the application and call methods on the
COM object, I get the following error:

System.Runtime.InteropServices.COMException: Class not registered

I've successfully registered the dll using regsvr32 and added
the AspCompat="true" directive on the Page, but doesn't seem to help.

I'd really appreciate any suggestions on how to remedy this problem.

Thanks for your time.

DonnieAre u using VS.NET?

"Donnie" <Donnie@.discussions.microsoft.com> wrote in message
news:2A43630B-C5AE-4AC7-9656-EA496352E760@.microsoft.com...
> Hello,
> I'm trying to develop an ASP.NET application that uses a third-party COM
> dll. I've added a reference to the dll in the web app project along with
> adding a "using" directive in the code-behind (referencing the COM
> namespace). Every time I try and run the application and call methods on
the
> COM object, I get the following error:
> System.Runtime.InteropServices.COMException: Class not registered
> I've successfully registered the dll using regsvr32 and added
> the AspCompat="true" directive on the Page, but doesn't seem to help.
> I'd really appreciate any suggestions on how to remedy this problem.
> Thanks for your time.
> Donnie

System.StackOverflowException

Hi All,

When I set the property of title in my class (Shown below) I get a
"Exception of type System.StackOverflowException was thrown." error message.

I'm guessing I got some sort of horrible loop going on, where did I go
wrong?

Thanks,
Simon.

Private pTitleAs String

Public Property Title() As String
Get
Return pStrTitle
End Get
Set(ByVal Value As String)
Title = pStrTitle
End Set
End PropertyHello
Change
Title = pStrTitle
to
pStrTitle = Value

Best regards,
Sherif

"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
you're setting the title of the string with pstrTitle, but the set action
itself calls the property again recursively. The solution provided by sherif
will fix the problem, i just thought you wanted to know the why.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @. www.lulu.com/owc, Amazon.com etc
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
Never mind - Realised my properties were in a right old mess :)

"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property

--
I am using the free version of SPAMfighter for private users.
It has removed 2175 spam emails to date.
Paying users do not have this message in their emails.
Try www.SPAMfighter.com for free now!
...but thanks for the replies (I posted my reply before yours appeared)

System.StackOverflowException

Hi All,
When I set the property of title in my class (Shown below) I get a
"Exception of type System.StackOverflowException was thrown." error message.
I'm guessing I got some sort of horrible loop going on, where did I go
wrong?
Thanks,
Simon.
Private pTitleAs String
Public Property Title() As String
Get
Return pStrTitle
End Get
Set(ByVal Value As String)
Title = pStrTitle
End Set
End PropertyHello
Change
Title = pStrTitle
to
pStrTitle = Value
Best regards,
Sherif
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
>
you're setting the title of the string with pstrTitle, but the set action
itself calls the property again recursively. The solution provided by sherif
will fix the problem, i just thought you wanted to know the why.
Regards,
Alvin Bruney - ASP.NET MVP
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @. www.lulu.com/owc, Amazon.com etc
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
>
Never mind - Realised my properties were in a right old mess :)
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
>
I am using the free version of SPAMfighter for private users.
It has removed 2175 spam emails to date.
Paying users do not have this message in their emails.
Try www.SPAMfighter.com for free now!
...but thanks for the replies (I posted my reply before yours appeared)