Showing posts with label values. Show all posts
Showing posts with label values. Show all posts

Saturday, March 31, 2012

System.Drawing.Text font question

Hello,

I've looked for answer to this everywhere but with no luck..

I need to dynamically create graphic text from database values. I've got this working fine if I use arial as the font but I want to use another font.

Now - presumably I can use any font installed on the server? But it doesn't seem to work. I want to use a font called blurLight but it just outputs in arial (I think - it's a standard font anyway)

Is there anything else I need to do to make other fonts available to asp.net other than just installing them on the server???

Thank you.Post some code so we can have a looksie
Alright - I will

<%@. Page Language="VB" Debug="True" %>
<%@. Import Namespace="System.Drawing" %>
<%@. Import Namespace="System.Drawing.Imaging" %>
<%@. Import Namespace="System.Drawing.Text" %>
<%
' Declare Vars
Dim objBMP As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim objFont As System.Drawing.Font

objBMP = New Bitmap(100, 30)

objGraphics = System.Drawing.Graphics.FromImage(objBMP)

objGraphics.Clear(Color.Green)

objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias

objFont = New Font("Arial", 16, FontStyle.Bold)

objGraphics.DrawString("Hello World", objFont, Brushes.White, 3, 3)

Response.ContentType = "image/GIF"
objBMP.Save(Response.OutputStream, ImageFormat.Gif)

objFont.Dispose()
objGraphics.Dispose()
objBMP.Dispose()
%

That code works fine but when I replace Arial with the font I want to use - it doesn't work..

Any ideas??

Monday, March 26, 2012

system.net.mail - email sending no longer working

Hi,

Previously on my web app I had a contact page that would send an email to me with all the filled in values from the user. The email would be sent with the FROM address the user put in, so when I received it I could reply back to them. I had this working for years, and now all of a sudden it errors out.

I get the following error. Please note I was using System.Net.Mail, but changed to a component to try and debug.

I'm wondering what would cause this error to happen suddenly? Perhaps a configuration change in IIS ? What would be a good work around to this ? Is it possible to maybe email from my own domain, but specify a different ReplyTo address?


Thanks,
mike123

Additional Help:452 4.2.2 Mailbox full
] Verify you can send email on behalf of'userFilledInName@dotnet.itags.org.hotmail.com' through the mail server 'domainName.com to'admin@dotnet.itags.org.domainName.com'. 'domainName.com' may not allow relaying for that specific address or domain, resulting with a 500 or larger error.Your server may also require a username and password for authentication, check with your mail server administrator. For additional information, enable logging by setting EmailMessage.Logging = true and if you have file write permission set a path for EmailMessage.LogPath, then check the log. If you are sending from an ASP.NET application and do not have file write access, wrap the EmailMessage.Send() in a Try..Catch() block and call Response.Write( EmailMessage.GetLog() ) from inside or after the Catch(). To ignore this error; set IgnoreRecipientErrors = true
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: aspNetEmail.SmtpProtocolException: [Additional Help:452 4.2.2 Mailbox full
] Verify you can send email on behalf of'userFilledInName@dotnet.itags.org.hotmail.com' through the mail server 'domainName.com to'admin@dotnet.itags.org.domainName.com'. 'domainName.com' may not allow relaying for that specific address or domain, resulting with a 500 or larger error.Your server may also require a username and password for authentication, check with your mail server administrator. For additional information, enable logging by setting EmailMessage.Logging = true and if you have file write permission set a path for EmailMessage.LogPath, then check the log. If you are sending from an ASP.NET application and do not have file write access, wrap the EmailMessage.Send() in a Try..Catch() block and call Response.Write( EmailMessage.GetLog() ) from inside or after the Catch(). To ignore this error; set IgnoreRecipientErrors = true

Source Error:


Line 200:
Line 201:
Line 202: msg.Send()
Line 203: msg = Nothing
Line 204:

Destination Full means exactly that. You're sending to an address where the mailbox will accept no more messages. You can't fix this, the problem is the recipient needs to read their mail and empty their mailbox.

Jeff


Hi Jeff,

Thanks for the lightning quick reply, but sorry I forgot to include this part. I have emptied the mail box, it is definately not full. Also to make sure it wasnt a server side mail problem I also tried sending to other email addresses that also were verified to not be full.

I was thinking it might have something to do with the relaying ? I can paste mail logs if that might help ?

Thanks again,
Mike123


anybody have any other thoughts on this ?

much appreciated

mike123

Thursday, March 22, 2012

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

Hi all,

I have the following peice of code:

Esssentially, a querystring containing a comma separated list of values is
used to populate the appropriate intSectionID property of a user control.

<% If Not(Request.QueryString("SectionID") Is Nothing) Then %
<% arrSectionID = Split(Request.QueryString("SectionID"), ",") %>
<Company:Links ID="LevelTwo" intSectionID="<%# arrSectionID(0) %>"
Runat="Server"/
<% End If %
However i keep gettting the error listed in my post..

Can someone fill me in on what could be going wrong?

I have a suspicion it may be occuring when the User Controls DataBind method
is called.
The variable is visible to the parent page, but not the user control??

Suggest a way to fix?

Cheers,
AdamAdam,
This is aspnet user group. <%# %> code is ASP. Yes a few things are still
used <% %> this is only available for backwards compatibility not new
development.
Use the page_load or Page_render events for processing the querry string
into your control.

Bad luck

"Adam Knight" wrote:

> Hi all,
> I have the following peice of code:
> Esssentially, a querystring containing a comma separated list of values is
> used to populate the appropriate intSectionID property of a user control.
> <% If Not(Request.QueryString("SectionID") Is Nothing) Then %>
> <% arrSectionID = Split(Request.QueryString("SectionID"), ",") %>
> <Company:Links ID="LevelTwo" intSectionID="<%# arrSectionID(0) %>"
> Runat="Server"/>
> <% End If %>
> However i keep gettting the error listed in my post..
> Can someone fill me in on what could be going wrong?
> I have a suspicion it may be occuring when the User Controls DataBind method
> is called.
> The variable is visible to the parent page, but not the user control??
> Suggest a way to fix?
> Cheers,
> Adam
>