Tuesday, October 27, 2009

Review of Microsoft Visual Web Developer 2010 beta 2 express edition.

Microsoft visual studio express editions are light weight IDE provided free by Microsoft and also having almost all the functionality of its big brother Microsoft Visual Studio Professional edition except few. My pc is bit old now Its P4 and its having only 1gigs of ram so the express edition are the best suited for pc like mine. Microsoft has recently provided the beta 2 version of Microsoft new generation IDE called Visual Studio Twenty Ten(2010).

There are lots of changes from visual studio 2008 express edition and Microsoft Visual Studio 2010 Express edition. The first changes you will notice is the brand new splash screen and brand new colored logo for visual studio.

LogoVisual Splash

Another thing you will notice is the look and fill of IDE. It all looks like blue every where. Its is best suited for the Microsoft forthcoming operating system Microsoft Windows 7.

VWD

Another the difference is the create new project window which is bit stylish and having more options compare the to the visual studio 2008. There are two new things in new project dialog the first one the windows azure tools which is Microsoft's new steps towards the could computing(I will blog about this later one). and another thing is the Silver light application option. Now you can create three kind of application with the Microsoft SilverLight Application

  1. Silverlight Application
  2. Silverlight Navigation Application
  3. Silverlight class library

OpenDialog

Another difference is the default font for the IDE earlier it was Courier New and now its Consolas which is the next generation programming font. Which is more visual than the other fonts.

Another major difference is when you create a asp.net web application then its now having more default folders compare to visual studio 2008. There are site.master is also there and some default style sheet just like asp.net mvc applications. You will have default login control like asp.net mvc application. There are two more folder scripts and styles. In style you will have default style sheet for the application. Another folder is for the scripts which are having default JQuery as per earlier announcement Microsoft and JQuery will go together.

SolutionsExplorer

Another new things in Microsoft Visual Studio 2010 Visual Web Developer Expression edition is the Tool Setting menu which are having three setting by default.

  1. Basic Settings
  2. Code Optimized
  3. Expert Settings.

All the three option will have different setting for solution explorer and all other stuff. Another new thing is visual web developer 2010 express edition having multi monitor support which is not there in earlier express editions.Visual web developer express also having windows presentation foundation code editor.

Another cool feature is the maximized windows in design view now you will have whole window is maximized in design view hiding other windows. So you visually look all the control more better. Another cool thing is the percentage dropdown through which you can set all screen by percentage as per your requirement.

There are lots of more features like Improved css compatibility,HTML and Javascript snippets,support for asp.net mvc application and support for multi target etc. I will blog about each feature in much more detail. T

If you still not downloaded the future version of visual studio express edition 2010 then you can download it from the following link.

http://www.microsoft.com/express/future/default.aspx

Shout it
Share:
Wednesday, October 7, 2009

Ahmedabad Community Tech Days- 3rd October-Rocks!!!

Last Saturday 3rd October. Ahmedabad .NET user group and Microsoft has organize the Microsoft Community Techdays. It was superb and well organized event thanks to Dhola Mahesh,Pinal Dave and Jacob Sebastian. We had four blasting session of Vinod Kumar, Pinal Dave, Jacob Sebastian and Prabhjot Singh Bakshi.

The first session was from vinod kumar on Microsoft Windows 7 and Microsoft Office 2010. Though he is sql server guy and very well known for his site. www.extremeexperts.com he has decided to take session for Microsoft Windows 7 and Microsoft Office 2010. The session was full of information and we have seen some of advance features of Microsoft upcoming operating system Windows 7 and new version of Microsoft Office 2010.

After that we went for the lunch and then followed by two sql server sessions from the Pinal Dave and Jascob Sebastian. Pinal Dave has taken session on SQL server Index and it was very useful session for any person related with software development. All the SQL Server index features is presented and he explains that where we should implement index and where we should not implement index for the better performance of queries through simples examples.

Then we have back to back session from Jacob Sebastian on the SQL Server errors . The session of awesome. I had never got such details explanation of the sql server error messages. He explained the best practices to write error handling code in sql server. Through it was session about error which every programmer hate it nobody was moved from his seat.

Then we had a tea break for 15 mins and after that Prabhjot Singh Bakshi has taken session on .NET Framework. The session was excellent and even advance concept was explain by simples examples. So overall it was great event and I enjoyed each and every session. Once again thanks for all the mentor of Ahmedabad .NET user group and Microsoft for organizing such events.

For more details about the event and photographs please visit following links.

http://blogs.sqlxml.org/vinodkumar/archive/2009/10/05/a-bad-ug-ctd-and-gandhi-ashram.aspx

http://blog.sqlauthority.com/2009/10/05/sqlauthority-news-community-techdays-in-ahmedabad-a-successful-event/

Share:
Thursday, July 30, 2009

Store Page ViewState in Session with asp.net

As we all know we any web page on the internet is state less. We have to write our own mechanism to maintain state between httprequest and httpresponse. Asp.net has great features called viewstate to maintain state during page postback. It will store the element state in hidden variables with _VIEWSTATE. It will look like below.

image

If you are having large amount of controls then you will have larger viewstate on the page and it will increase your html kb as well as your performance. So to increase the performance of our application we need to store this viewstate in other place. ASP.NET 2.0 has nice new class called SessionPagePersister which will store the viewstate in the session. You just need to override the PageStatePersister property in your page and your viewstate will be on the page.

Here is the code.



Code Snippet


  1. protected override PageStatePersister PageStatePersister
  2. {
  3. get
  4. {
  5. return new SessionPageStatePersister(this);
  6. }
  7. \



If you are having so many pages then you have to write that cod manually Instead of doing this you can use inheritance features of C#.NET to write the code in just one way and then inherit your page from that class. Following is the code for that. You can create a class called MyPage that class into all the pages here is the code for class MyPage .


Code Snippet


  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;

  6. namespace TestBlogApplication
  7. {
  8. public class MyPage:System.Web.UI.Page
  9. {
  10. protected override PageStatePersister PageStatePersister
  11. {
  12. get
  13. {
  14. return new SessionPageStatePersister(this);
  15. }
  16. }

  17. }
  18. \



and Then inherit the class in your page like following.



Code Snippet


  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;

  7. namespace TestBlogApplication
  8. {
  9. public partial class Page1 : MyPage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {

  13. }
  14. }
  15. }




So that's it that way you can increase your application performance via maintaining the viewstate in session. Happy Codding..

Share:
Sunday, July 26, 2009

Extend your existing classes with extension method in asp.net 3.5

In asp.net 3.5 there is one good features called extension method now you can extend your functionality without modifying existing classes. Extension method allow developers to add own functionality to any existing classes. You don't need to create subclass or don't need to recompile existing classes and still you can extend that class with extension methods. Let's create an example to extend existing string classes to convert a simple string to bold html string.
public static class MyExtensions
{
public static string ConvertToBold(this string mystring)
{
System.Text.StringBuilder myBoldString =new System.Text.StringBuilder(string.Empty);
myBoldString.Append("<strong>");
myBoldString.Append(mystring);
myBoldString.Append("</strong>");
return myBoldString.ToString();  
}
}
So now our extension method is ready. Following the sample code to use this extension method.
protected void Page_Load(object sender, EventArgs e)
{
string helloWorld = "Hello World";
Response.Write(helloWorld.ConvertToBold());
}
While running application you can out like below.
Extension 
Share:

What's new in sql server 2008

Microsoft SQL Server are one of the popular RDBMS(Relational Database Management System) all over world. Before some time Microsoft has launched the new version of SQL Server 2008. SQL Server 2008 provides the highest levels of security, reliability, and scalability for your business-critical applications. . Following are the some of new features of SQL Server 2008.

  1. Policy based management.
  2. Performance Data Collection.
  3. Data compression.
  4. Resource Generator.
  5. Transparent Data Encryption.
  6. External Key Management/Extensible Key Management.
  7. Data Auditing.
  8. Hot-Add CPU and Hot-Add Memory.
  9. Streamlined Installation.
  10. Server Group Management.
  11. Upgrade Advisor.
  12. Partition aligned indexed views.
  13. Backup Compression.
  14. Extended Events.
  15. Grouping Set.
  16. Merge Operator.
  17. Greater Support for LINQ and Entity Framework.
  18. Change Data Capture.
  19. Table Valued Parameters.
  20. Entity data model for entity framework.
  21. Synchronization Server with ADO.NET.
  22. CLR Improvements.
  23. Conflict detection between peer to peer Replication
  24. Service Broker Priorities and Diagnostics.
  25. Spatial Data with Geography and Geometry data types.
  26. Virtual Earth Integration.
  27. Sparse Column.
  28. Filtered Indexes.
  29. Integrated full text search.
  30. File stream data.
  31. Large user defined types.
  32. Large user defined aggregates.
  33. Date/Time Data Types.
  34. Improved XML Support.
  35. ORDPATH.

and many more features are there. It's great rdbms to use in your future projects. Please visit following link to explore above features in great details.

http://www.microsoft.com/sqlserver/2008/en/us/whats-new.aspx

You can download SQL server 2008 Express database for free from following link.

http://www.microsoft.com/express/sql/download/

Share:

How to remove white spaces between tags and lines of html render by asp.net page

When asp.net page loaded in to browser there are lots of white spaces between tags and in tags that will increase your html kb. For example if your page around 300 kb then it will take 3 second to load on 100 kbps internet connection and in dial up connection it will still take time. So if you want to load your site fast on dial up internet connection then you need to decrease html kb as much you can and removing white spaces from the html will be good idea for that.

Following is the code for the page on which you want to remove white spaces from the html. It will decrease your html kb by 30 percentage.

private static readonly Regex REGEX_FOR_TAGS = new Regex(@">s+<", RegexOptions.Compiled);

private static readonly Regex REGEX_FOR_BREAKS = new Regex(@">[\s]*<",
RegexOptions.Compiled);
protected override void Render(HtmlTextWriter writer)
{
using (HtmlTextWriter writer = new HtmlTextWriter(new System.IO.StringWriter()))
{
base.Render(writer);
string htmlkb = writer.InnerWriter.ToString();
htmlkb = REGEX_FOR_TAGS.Replace(htmlkb, "> <");
htmlkb= REGEX_FOR_BREAKS .Replace(htmlkb, "><");
writer.Write(html.Trim());
}
}

Here in the above code there are two regular expression one for white space in tag and another for whitespace between tag and by just overriding the render event of event you can replace the whitespace.

Happy Coding...

Technorati Tags: ,,,

Share:
Saturday, July 25, 2009

Sending mail with secure service layer in asp.net 3.5/2.0

In earlier post i have mentioned that how to send the email using new System.Net.Smtpmail with asp.net 2.0 or higher version. Now lets learn how to send the mail with the secure service layer in the asp.net.

Security is the one of the most important requirement in today’s world as you are doing your business online you have keep secure from other wrong elements. Secure service layer add an

extra layer of security to your web application and sending mail with the SSL with tighten your security for mails. Your emails are more secure then ever and your valuable information will not going to wrong hands.

Here is the code from which we can send the email with the secure service layer. As i have mentioned in earlier post you need to to send email with authentication to use SSL. So you need to write following code. First you need to create message like following..

MailAddress fromAddress = new MailAddress("[email protected]","Nameofsendingperson");
message.From = @”fromAddress”;//here you can set address
message.To.Add("mailto:[email protected]%22%29;//");//
message.Subject = "Sending email with ssl";
message.CC.Add("[email protected]");//ccing the same email to other email address
message.Bcc.Add(new MailAddress("[email protected]"));//here you can add bcc address
message.IsBodyHtml = true;//To determine email body is html or not
message.Body =@"Plain or HTML Text";
Then you have to sent message with following code.
System.Net.Mail.SmtpClient mailClient =
 new System.Net.Mail.SmtpClient("your smptp","ssl port");
//This object stores the authentication values
System.Net.NetworkCredential basicCrenntial = 
new System.Net.NetworkCredential("username", "password");
mailClient.Host = "Host";
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = basicCrenntial;
// You have to add one other properties for SSL
mailClient.EnableSSL=true;
mailClient.Send(message);
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews