rss feed blog search engine
 
Search rss blog search engine
 
KaushaL.NET  
Released:  9/18/2008 9:59:28 AM
RSS Link:  http://dotnetslackers.com/Community/blogs/kaushalparik/rss.a ..
Last View 11/21/2008 5:16:41 AM
Last Refresh 11/21/2008 4:05:14 PM
Page Views 149
Comments:  Read user comments (0)
Save It Add to Technorati Add to Del.icio.us Add to Furl Add to Yahoo My Web 2.0 Add to My MSN Add to Google Add to My Yahoo! KaushaL.NET



Description:



{ a .net developer's blog; } //sharing scenarios I faced in development


Contents:

Microsoft DreamSpark - Sparking a billion Dreams

Microsoft launches DreamSpark: Indian students get access to technical software at no charge

Bill Gates talks to students about the use of technology in improving lives

-  Access to software developer and designer tools to students at no charge

-  DreamSpark includes:

o    Visual Studio 2005/2008 Professional Edition,

o    Expression Studio (includes Web, Blend, Media and Design),

o    SQL Server 2005 Express, SQL Server 2005 Developer Edition,

o    Windows Server 2008 Standard Edition,

o    XNA Game Studio 2.0 and

o    12-month trial academic subscription to the XNA Creators Club

-  Available online on www.dreamsparkindia.com; and via DVDs at NIIT, Aptech and Hughes Net Fusion Centers

 




Happy Navaratri to you all!!

wishing you all people happy Navaratri! God Bless us all...




Visualize your .NET code with nAML!

Understanding the architecture and code in software application plays as major factor while building good software products.

Along with specification, examples and tools, a new visual modeling technique being introduced, termed as “nAML” (.NET Application Modeling Language), which overcomes the limitation of typical modeling languages in a revolutionary way! Nothing much to say, just download (FREE) it and you can get to know how POWERFUL it is!

Here is the project site: http://code.msdn.microsoft.com/naml

The project is currently in Beta 1 phase. Your valuable input/feedback in this thread will greatly help to make it much better.
Here is a free e-book introduces this visual modeling technique:  http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=naml&DownloadId=3083




How to send an email with attachment in asp.net 2.0

I have seen many posts over forums asking for how to send emails in asp.net.

In this blog post, I am going to post code snippet to send email in asp.net (with / without attachment).

MoreOver, for Complete FAQ for the System.Net.Mail namespace found in .NET 2.0 (Click here for System.Web.Mail). This is an excellent resource to understand total mail functionalities in asp.net.

Check out Below Code to send email in asp.net:

C#

using System.Net;
using System.Net.Mail;
-----------------------

public static bool SendMail(string strFrom, string strTo, string strSubject, string strMsg)
{
try
{
// Create the mail message
MailMessage objMailMsg = new MailMessage(strFrom, strTo);

objMailMsg.BodyEncoding = Encoding.UTF8;
objMailMsg.Subject = strSubject;
objMailMsg.Body = strMsg;
objMailMsg.Priority = MailPriority.High;
objMailMsg.IsBodyHtml = true;

//prepare to send mail via SMTP transport
SmtpClient objSMTPClient = new SmtpClient();
objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
objSMTPClient.Send(objMailMsg);
return true;
}
catch (Exception ex)
{
throw ex;
}
}

 
VB:

Public Shared Function SendMail(ByVal strFrom As String, ByVal strTo As String, ByVal strSubject As String, ByVal strMsg As String) As Boolean
Try

' Create the mail message
Dim objMailMsg As MailMessage = New MailMessage(strFrom, strTo)

objMailMsg.BodyEncoding = Encoding.UTF8
objMailMsg.Subject = strSubject
objMailMsg.Body = strMsg
objMailMsg.Priority = MailPriority.High
objMailMsg.IsBodyHtml = True

'prepare to send mail via SMTP transport
Dim objSMTPClient As SmtpClient = New SmtpClient()
objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
objSMTPClient.Send(objMailMsg)
Return True
Catch
ex As Exception
Throw ex
End Try
End Function



Code to send mail with attechment.,

public static bool SendMail(string strFrom, string strTo, string strSubject, string strMsg)
{
try
{
// Create the mail message
MailMessage objMailMsg = new MailMessage(strFrom, strTo);

objMailMsg.BodyEncoding = Encoding.UTF8;
objMailMsg.Subject = strSubject;
objMailMsg.Body = strMsg;
Attachment at = new Attachment(Server.MapPath("~/Uploaded/txt.doc"));
objMailMsg.Attachments.Add(at);
objMailMsg.Priority = MailPriority.High;
objMailMsg.IsBodyHtml = true;

//prepare to send mail via SMTP transport
SmtpClient objSMTPClient = new SmtpClient();
objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
objSMTPClient.Send(objMailMsg);
return true;
}
catch (Exception ex)
{
throw ex;
}
}

Referecned Thread link: How to send an email with attachment in asp.net 2.0 - ASP.NET Forums

hope this helps.




South Asia MVP Open Day 2008 at Goa, India

There will be South Asia MVP Open Day 2008 at Goa, India near around mid of November! Goa is a marvalous city with its lively culture, sumptuous food, and of course the beaches! I am eagerly waiting for!!


I am expected to have Business and social networking with other fellow MVPs, interesting conversations and interactive technical sessions with Microsoft product groups and fellow MVPs.


Here is a Comic representation of South Asia Open Day 2008 :)




Generate Thumbnail images in ASP.NET

I needed to generate Medium (250 X 250) and small (150 X 150) size images from Large (500 X 500) size images as Product images to display in a shopping cart application.

To generate thumbnail images (for scenario I wrote above, or to display iconic Product images within GridView along with Product Details):

        System.Drawing.Image imThumbnailImage;
        System.Drawing.Image _InputImage = System.Drawing.Image.FromFile(Server.MapPath("large.jpg"));

        imThumbnailImage = _InputImage.GetThumbnailImage(100, 100,
                     new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
        imThumbnailImage.Save(Server.MapPath("thumb.jpg"));

        imThumbnailImage.Dispose();
        _InputImage.Dispose();


    public bool ThumbnailCallback() { return false; }

Image.GetThumbnailImage Method (System.Drawing) is used to generate thumbnails.
Parameters to pass in this method are:

thumbWidth (Int32):
    The width, in pixels, of the requested thumbnail image.
thumbHeight (Int32):
    The height, in pixels, of the requested thumbnail image.
callback (System.Drawing.Image.GetThumbnailImageAbort):
    A Image.GetThumbnailImageAbort delegate. In GDI+ version 1.0, the delegate is not used. Even so, you must create a delegate and pass a reference to that delegate in this parameter.
callbackData (System.IntPtr):
    Must be Zero.




Streaming Audio Files in ASP.NET

I was having a requirement to Stream Audio files in one of my on-going ASP.NET application; While I googled, I found that to Stream Audio files in a webpage, we need to use <object> tag.
The <object> element can support many different media types, like:

  • Pictures
  • Sounds
  • Videos
  • Other Objects

We just need to add the Windows Media Player reference using <object> tag with class ID. Windows Media Player comes in many different versions. The class IDs are different for different versions, with a list of parameters you can set (most of them are boolean and self explanatory).

For Windows Media Player 6.4; which I am using, classID should be clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95. The class ID for Windows Media Player 7 and later is: clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6. Many places on the internet it states that the class ID should be: clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95. This class ID is the old one, but it will work, because of backward compability. However, if you use the old class ID you will not be able to use the new features added to the component.

Below is Sample Code for adding <object> tag in your HTML design code which is having reference to Windows Media Player 6.4 with classID as clsid: 22D6F312-B0F6-11D0-94AB-0080C74C7E95.

        <div>
            <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="MediaPlayer1">
                <param name="AudioStream" value="true">
                <param name="AutoSize" value="true">
                <param name="AutoStart" value="false">
                <param name="ClickToPlay" value="true">
                <param name="Enabled" value="true">
                <param name="Filename" value="BilloRani_Goal.mp3"> <%--The URL of the file name you want to play--%>
                <param name="AnimationAtStart" value="true">
                <param name="ShowDisplay" value="true">
                <param name="ShowAudioControls" value="true">
                <param name="ShowDisplay" value="true">
                <param name="ShowStatusBar" value="true">
                <param name="ShowGotoBar" value="true">               
            </object>           
        </div>

Here are the list of parameters you can use with Windows Media Player 6.4 reference, they are almost self explanatory: Windows Media Player Reference in ASP.NET




Accessing SMTP Mail Settings defined in Web.Config File Programmatically

I needed to read my SMTP email settings defined under system.net section in my web.config file. In order to use eNewsLetter and other SiteAdmin CMS modules that sending email notifications; you can setup your web.config to defind SMTP services settings.

Below is one example of SMTP email setting defined in web.config file:
(Under <configuration> Section)

    <system.net>
        <mailSettings>
            <smtp deliveryMethod="Network" from="testuser@domail.com">
                <network defaultCredentials="true" host="localhost" port="25" userName="kaushal" password="testPassword"/>
            </smtp>
        </mailSettings>
    </system.net>

To Access, this SMTP Mail Setting Programatically, you need to import below namespaces:



Home  


 


Link to us




RSS Feed of new blogs                                                   Home        Feed Map        Submit Feed      Link to Us       Contact