What is the Windows Azure platform - A quick start for beginners?


Microsoft has announced a new cloud-based version of Windows called Azure. Windows Azure allows you to build, host and scale applications in Microsoft datacenters. They require no up-front expenses, no long term commitment, and enable you to pay only for the resources you use. Azure applications run on Microsoft's data centers instead of in-house servers. There is nothing new in hosting applications on the internet, but what's interesting is what Microsoft is doing to make such applications easier to create and, crucially, to scale smoothly at times of peak demand.


Azure service will be pay-as-you-go computing, with Azure bringing new virtual servers online as needed. Azure also provides essential services such as database and document storage. The end user will not notice any difference, since Azure applications will look like any other web or Windows application, but companies benefit by off-loading investment in computer hardware and management to Microsoft, and paying only for the computing power they actually use.

This is not the first cloud computing platform. Amazon is a pioneer in the field, with services such as the Elastic Compute Cloud, which hosts virtual computers running Linux or Windows, the SimpleDB cloud database and the Simple Storage Service, which stores files online. Google has its App Engine, which is like Azure in that it hosts applications, along with a data store called BigTable. Salesforce.com has an online application platform called Force.com, which it calls Platform as a service.

Microsoft's advantage is that Azure is familiar territory for developers who already know Windows. Azure uses the .NET Framework for programming and hooks into other Microsoft services like Exchange for email and SharePoint for document collaboration. Azure also allows companies to extend their existing user directory to Azure web applications.

Microsoft expects organizations to adopt Azure gradually, integrating it with their existing systems. It is a hybrid approach that will be attractive to organizations wary of trusting everything to the cloud.

That said, Microsoft also has challenges in selling Azure. It is perceived as a Windows company, not a web company, and its current business model depends on selling software licenses for on-premise servers, supported by armies of partners with skills in installing and maintaining these systems. If Azure succeeds, the need for all these partners will diminish, so Microsoft is disrupting its own community.



Companies like Google and Amazon do not carry all this baggage. Another snag with cloud services is that they sometimes fail, with potentially severe consequences for business. "We wouldn't say we'd never have downtime," admits Mark Rogers, director of cloud services. Even in the preview phase, the industry will be watching Azure to see whether that promised resilience will be delivered.

Important Links:

What are the new features of .NET Framework 4.0?

 One more new Framework for Microsoft .NET namely .NET Framework 4.0. So, What's New in the .NET Framework 4? I think Microsoft has the answer. Here what they say, The .NET Framework is an integral Windows component that supports building and running the next generation of applications and Web services. The key components of the .NET Framework are the common language runtime (CLR) and the .NET Framework class library, which includes ADO.NET, ASP.NET, Windows Forms, and Windows Presentation Foundation (WPF).



The .NET Framework provides a managed execution environment, simplified development and deployment, and integration with a wide variety of programming languages. The .NET Framework 4 introduces an improved security model. As per my reserch I have found the following new feathers for Microsoft .NET Framework 4.0,


  1. Application Compatibility and Deployment.
  2. Core New Features and Improvements.
  3. Managed Extensibility Framework
  4. Parallel Computing.
  5. Networking.
  6. Web.
  7. Client.
  8. Data.
  9. Windows Communication Foundation.
  10.  Windows Presentation Foundation.
  11. Windows Workflow Foundation.
This is one more big top to complete.
You can find more information here

What is the difference between WCF and Web Services?

Let me tell you the definition of two and then explain the main difference.


Windows Communication Foundation(WCF):
       
         WCF stands for Windows Communication Foundation. WCF is a unified programming model for building service oriented application. WCF is the next generation of distributed applications and Web Services. It consist of a runtime and classes in System.ServiceModel namespace.

Web Services:
       
         Web Services are business logic compnents, which provide functionality via the internet using standard protocols such as HTTP. Web Services uses Simple Object Access Protocol (SOAP) in order to expose the business functionality. SOAP defines a standardized format in XML.

Differences:


WCF

Web Services
While WCF Service or a WCF component can be invoked by any protocol (like http, tcp etc.) and any transport type.

Web services can only be invoked by HTTP (traditional webservice with .asmx).

WCF are flexible.

Web Services not are flexible.
WCF service can also maintain state and session.
WCF service can not maintain state and session.

Confirmation dialog box in Code Behind using C#( C-Sharp ) in ASP.NET

You can call a confirmation dialog box from code behind using c#. Copy follow the code in respective files.

Copy this is HTML

<p>
<asp:Button id="btnSave" runat="server" Text="Save and Update 'RFFM'" OnClientClick="return UpdateRFFM();" />
</p>

Copy this in C# code behind.
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Text;
using ADI.Web;

namespace SIS
{
public partial class update_sis : System.Web.UI.Page
{
SqlCommand cmd;
SqlParameter pm;
string strForm = "";
StringBuilder sb;
string strError = "";
int UpdateStatus = -1;
string strEmailTemplate = "";

protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "text/plain";
Response.Cache.SetCacheability(HttpCacheability.NoCache);

if (Request["form_name"] == null)
{
Response.Write("");
Response.End();
}
strForm = Utils.ToStringNullSafe(Request["form_name"]);
sb = new StringBuilder();

if (Session["ApplicationId"] == null)
{
Response.Write("Bad Request...");
Response.End();
}

int ApplicationId = int.Parse(Session["ApplicationId"].ToString());

switch (strForm)
{
case "rffm_create_user":
if (Session["email"] == null)
{
Response.Write("Bad Request");
Response.End();
}
Session["errmsg"] = "";
try
{
cmd = new SqlCommand("usp_SIS_PutUser");

// output parameter
pm = new SqlParameter("@UpdateStatus", SqlDbType.Int);
pm.Direction = ParameterDirection.Output;
cmd.Parameters.Add(pm);

// input parameters
cmd.Parameters.Add("Id", SqlDbType.Int).Value = 0;
cmd.Parameters.Add("@UserName", SqlDbType.VarChar, 50).Value = Session["Email"].ToString();

string strPassword = System.Guid.NewGuid().ToString().Substring(0, 8);

cmd.Parameters.Add("@Password", SqlDbType.VarChar, 50).Value = Utils.base64Encode(strPassword);
cmd.Parameters.Add("@Active", SqlDbType.Bit).Value = false;
int ClubId = int.Parse(Session["ClubId"].ToString());
if (ClubId > 0)
{
cmd.Parameters.Add("@Group_Id", SqlDbType.Int).Value = 31;
cmd.Parameters.Add("@Club_Id", SqlDbType.Int).Value = ClubId;
cmd.Parameters.Add("@NonClub_Id", SqlDbType.Int).Value = (object)DBNull.Value;
}
else
{
cmd.Parameters.Add("@Group_Id", SqlDbType.Int).Value = 32;
cmd.Parameters.Add("@Club_Id", SqlDbType.Int).Value = (object)DBNull.Value;
cmd.Parameters.Add("@NonClub_Id", SqlDbType.Int).Value = int.Parse(Session["Non_ClubId"].ToString());
}

Utils.executeSP(cmd);
Session.Remove("emil");
strError = "";

if (Session["errmsg"].ToString() != "") 
strError = "-1" + Session["errmsg"].ToString();

if (strError == "")
{
int UpdateStatus = int.Parse(cmd.Parameters["@UpdateStatus"].Value.ToString());
if (UpdateStatus < 0)
strError = "-1There was a problem when creating new user. Please contact Admin";
else
{
// send email
strEmailTemplate = Utils.ReadTemplate("newuser.txt");
strError = "00" + SIS_Site.SendEmail(UpdateStatus, strEmailTemplate);
}
}
} catch (Exception ex) {
strError = "-1" + ex.Message;
}
break;
case "rffm_SendVerificationEmail":
// send email
if (Session["UserId"] == null)
{
Response.Write("Bad Request");
Response.End();
}
strError = "";
strEmailTemplate = Utils.ReadTemplate("newuser.txt");
strError = "00" + SIS_Site.SendEmail(int.Parse(Session["UserId"].ToString()), strEmailTemplate);
Session.Remove("UserId");
break;
case "rffm_UserSetupVerify":
strError = "";
try
{
cmd = new SqlCommand("usp_SIS_UserSetupVerify");

// output parameter
pm = new SqlParameter("@UpdateStatus", SqlDbType.Int);
pm.Direction = ParameterDirection.Output;
cmd.Parameters.Add(pm);

SqlParameter pm2 = new SqlParameter("@EMail", SqlDbType.VarChar, 500);
pm2.Direction = ParameterDirection.Output;
cmd.Parameters.Add(pm2);

SqlParameter pm3 = new SqlParameter("@Updatetext", SqlDbType.VarChar, 200);
pm3.Direction = ParameterDirection.Output;
cmd.Parameters.Add(pm3);

SqlParameter pm4 = new SqlParameter("@UserId", SqlDbType.Int);
pm4.Direction = ParameterDirection.Output;
cmd.Parameters.Add(pm4);

// input parameters
cmd.Parameters.Add("@ApplicationId", SqlDbType.Int).Value = ApplicationId;

Utils.executeSP(cmd);

if (Session["errmsg"] != null)
strError = Session["errmsg"].ToString();

if (strError == "")
{
UpdateStatus = int.Parse(cmd.Parameters["@UpdateStatus"].Value.ToString());
if (UpdateStatus < 0)
strError = "There was an error when processing your request";
}

Session["email"] = cmd.Parameters["@EMail"].Value.ToString();
Session["UserId"] = cmd.Parameters["@UserId"].Value.ToString();
Session["Updatetext"] = cmd.Parameters["@Updatetext"].Value.ToString();

switch (UpdateStatus)
{
case 1:
strError = "1";
break;
case 2:
strError = "2";
break;
case 3:
strError = "3";
break;
case 4:
strError = Session["Updatetext"].ToString();
break;
case 5:
strError = "5" + Session["Updatetext"].ToString();
break;
default:
break;
}
}
catch (Exception ex)
{
strError = ex.Message;
}
break;

case "rffm":
Session["current_tab"] = "rffm";
try
{
cmd = new SqlCommand("usp_SIS_PutProjectProfile");

// output parameter
pm = new SqlParameter("@UpdateStatus", SqlDbType.Int);
pm.Direction = ParameterDirection.Output;
cmd.Parameters.Add(pm);

// input parameters
cmd.Parameters.Add("@ApplicationId", SqlDbType.Int).Value = ApplicationId;
cmd.Parameters.Add("@LastSavedBy", SqlDbType.VarChar, 50).Value = Session["user"].ToString();

cmd.Parameters.Add("@FeasibilityStudyDocument", SqlDbType.VarChar, 8000).Value = Request["FeasibilityStudy"];
cmd.Parameters.Add("@PlanningPermissionNotRequired", SqlDbType.VarChar, 8000).Value = Request["PlanningPermissionNotRequired"];
cmd.Parameters.Add("@Sustainable", SqlDbType.VarChar, 8000).Value = Request["Sustainable"];

string strRDMRecommendation = Request["RDMRecommendation"];
cmd.Parameters.Add("@RDMRecommendation", SqlDbType.VarChar, 8000).Value = (strRDMRecommendation == null) ? (object)DBNull.Value : strRDMRecommendation;

cmd.Parameters.Add("@Risk", SqlDbType.VarChar, 10).Value = Request["Risk"];
cmd.Parameters.Add("@Region", SqlDbType.VarChar, 50).Value = Request["Region"];
cmd.Parameters.Add("@RDMName", SqlDbType.VarChar, 50).Value = Session["user"].ToString();
cmd.Parameters.Add("@RDMReviewDate", SqlDbType.DateTime).Value = DateTime.Now;
cmd.Parameters.Add("@DesignAndPlanningPermission", SqlDbType.VarChar, 8000).Value = Request["DesignAndPlanningPermission"];
cmd.Parameters.Add("@RecommendationOfProjectNeedAgainstSDA", SqlDbType.VarChar, 8000).Value = Request["RecommendationOfProjectNeedAgainstSportsDevelopmentActivity"];
cmd.Parameters.Add("@ValueForMoneyAssessment", SqlDbType.VarChar, 8000).Value = Request["ValueForMoneyAssessment"];
cmd.Parameters.Add("@ActionId", SqlDbType.Int).Value = int.Parse(Request["ActionId"].ToString());
cmd.Parameters.Add("@ActionNotes", SqlDbType.VarChar, 500).Value = "RFFM";

Utils.executeSP(cmd);

if (Session["errmsg"] != null)
strError = Session["errmsg"].ToString();

if (strError == "")
{
UpdateStatus = int.Parse(cmd.Parameters["@UpdateStatus"].Value.ToString());
if (UpdateStatus < 0)
strError = "There was an error when processing your request";
else
Session["current_tab"] = "";
}
}
catch (Exception ex)
{
strError = ex.Message;
}
break;

case "check_session":
if (Session["ApplicationId"] != null)
{
string hfID = Request["hf_ApplicationId"].ToString();
string sfID = Session["ApplicationId"].ToString();

if (hfID != sfID)
{
strError = "-1";
}
}
break;
default:
strError = "Bad request";
break;

}

Response.Write(strError);
}
}
} 
 
 
 
Copy this in Javascript file

function UpdateRFFM()
{
var msg;
var status_code;
var rffmAction = $(".rffmAction").val();
var Risk = $(".ddlRisk").val();
var Region = $(".ddlRegion").val();
var strError = "";

if (rffmAction == "151") {
if (Risk == "")
strError = strError + "Please select a Risk\n";
if (Region == "")
strError = strError + "Please select a Region\n";                
}

if (strError != "") {
alert(strError);
return false;
}

var reply = false;

if (rffmAction == "151") {
$.post(getFullPath("update_sis.aspx"), 
{form_name: 'rffm_UserSetupVerify'}, function(data) {
if (data.length > 0)
status_code = data.substring(0, 1);
else
status_code = '';

switch(status_code) {
case '0':
UpdateRFFM_Normal();
break;
case '1':
$.post(getFullPath("update_sis.aspx"),
{form_name: 'rffm_create_user'}, function(data) {
status_code = data.substring(0, 2);
msg = data.substring(2);
if (status_code == "-1") 
alert(msg);
else {
alert('created new user account\n\n' + msg);
UpdateRFFM_Normal();
}                                    
});
break;
case '2':
UpdateRFFM_Normal();
break;
case '3':
$.post(getFullPath("update_sis.aspx"),
{form_name: 'rffm_SendVerificationEmail'}, function(data) {
status_code = data.substring(0, 2);
msg = data.substring(2);
if (status_code == "-1") 
alert(msg);
else {
alert('verification email sent\n\n' + msg);
UpdateRFFM_Normal();
}
});
break;
case '4':
alert(data);
break;
case '5':
msg = data.substring(1);
if (confirm(msg) == true) {
$.post(getFullPath("update_sis.aspx"),
{form_name: 'rffm_SendVerificationEmail'}, function(data) {
status_code = data.substring(0, 2);
msg = data.substring(2);
if (status_code == "-1") 
alert(msg);
else 
alert('verification email was sent\n\n' + msg);
UpdateRFFM_Normal();
});
}
break;                                                                                                
default:
alert(data);
break;
}
});
} else
UpdateRFFM_Normal();

return reply;
}
function UpdateRFFM_Normal() {
var reply = false;         
$.post(getFullPath("update_sis.aspx"), {form_name: 'rffm',
FeasibilityStudy: $(".FeasibilityStudy").val(),
PlanningPermissionNotRequired: $(".PlanningPermissionNotRequired").val(),
Sustainable: $(".Sustainable").val(),
RDMRecommendation: $(".RDMRecommendation").val(),
Risk: $(".ddlRisk").val(),
Region: $(".ddlRegion").val(),
DesignAndPlanningPermission: $(".DesignAndPlanningPermission").val(),
RecommendationOfProjectNeedAgainstSportsDevelopmentActivity: $(".RecommendationOfProjectNeedAgainstSportsDevelopmentActivity").val(),
ValueForMoneyAssessment: $(".ValueForMoneyAssessment").val(),
ActionNotes: $(".ActionNotes").val(),
ActionId: $(".rffmAction").val()
}, function(data) {
if (data.length > 0) {
alert(data);
return false;
} else {
window.location = getFullPath("application_form.aspx");
return false;
}
});
}

Hello, World! in C# 2010

You can learn to create classes in the C# language. Consider the following code example, which define a class:

using System;
public class Hello
{
public static void Main(string[] args)
{
System.Console.WriteLine("Hello, World!\n");
}
}

Output: Hello, World!

The preceding class declaration provides a method Main() that will display the message "Hello, World!" on your screen.
 

About Me

It's Me!Hi, I'm Moinuddin. I'm a Software Engineer at WIPRO working on Microsoft .NET Technology. I'm interested in a wide range of technology topics, mainly Microsoft including Windows Azure, WCF, WPF, Silverlight and any other cool technology that catches the eye.

Site Info

ProjectCSharp.com is mainly about demonstrating real time examples in different technologies like ASP.NET, WCF, WPF, Silverlight, Azure etc..,

Followers

Help Links

Project CSharp (C#) Copyright © 2011. All Rights Reserved.