http://debugmode.net/2011/05/09/exposing-wcf-rest-service-over-https/
Saturday, May 28, 2011
Friday, May 27, 2011
Monday, May 23, 2011
jquery validations link exaples
http://www.java2s.com/Code/JavaScript/Form-Control/Validateanumber.htm
Thursday, May 19, 2011
servicehost (web.config)------crossdomainpolacy
?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="crossdomain" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
<services>
<service name="Tenderslibrary.Service1">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="WEB"
bindingConfiguration="crossdomain" contract="Tenderslibrary.IService1" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WEB">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="crossdomain" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
<services>
<service name="Tenderslibrary.Service1">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="WEB"
bindingConfiguration="crossdomain" contract="Tenderslibrary.IService1" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WEB">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Wednesday, May 18, 2011
jquery datepicker source code and link as well
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>dynDateTime: jQuery calendar plugin based on Dynarch date time calendar </title>
<script src="datepickerjs/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="datepickerjs/jquery.dynDateTime.js" type="text/javascript"></script>
<script src="datepickerjs/calendar-en.js" type="text/javascript"></script>
<link href="datepickerjs/calendar-win2k-cold-1.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>dynDateTime</h1>
<p>See project <a href="http://code.google.com/p/dyndatetime/">home page</a> for details.</p>
<form action="/nothing/to/post.to">
<div>
<h3>Default with no options</h3>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#dateDefault").dynDateTime(); //defaults
});
</script>
<input type="text" name="dateDef" id="dateDefault"/>
<hr/>
<h3>Bind to multiple inputs in one go</h3>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#multi input").dynDateTime({
button: ".next()" //next sibling
});
});
</script>
<div id="multi">
<input type="text" name="dateA"/>
<button type="button">PICKER</button>
<br/>
<input type="text" name="dateB"/>
<button type="button">PICKER</button>
<br/>
<input type="text" name="dateC" value="2001/09/11"/>
<button type="button">PICKER</button>
<br/>
</div>
<hr/>
<h3>Using time, custom format, display output, and different pop-up location</h3>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#dateTimeCustom").dynDateTime({
showsTime: true,
ifFormat: "%Y/%m/%d-%H:%M",
daFormat: "%l;%M %p, %e %m, %Y",
align: "TL",
electric: false,
singleClick: false,
displayArea: ".siblings('.dtcDisplayArea')",
button: ".next()" //next sibling
});
});
</script>
The selected date is <span class="dtcDisplayArea"></span> <br/>
<input type="text" name="dateTimeCust" id="dateTimeCustom"/>
<button type="button">PICKER</button>
<hr/>
<h3>Flat example</h3>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#dateFlat").dynDateTime({
flat: ".next()",
debug: false
});
});
</script>
<input type="text" name="dateDef" id="dateFlat" value="2001/09/11"/>
<div style="float: left;"> </div>
<hr style="clear: both;"/>
</div>
</form>
<p>
<a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Strict" height="31" width="88" />
</a>
</p>
</body>
</html>
http://www.mechanicalmarksy.com/hosted/toolman/dyndatetime/example.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>dynDateTime: jQuery calendar plugin based on Dynarch date time calendar </title>
<script src="datepickerjs/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="datepickerjs/jquery.dynDateTime.js" type="text/javascript"></script>
<script src="datepickerjs/calendar-en.js" type="text/javascript"></script>
<link href="datepickerjs/calendar-win2k-cold-1.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>dynDateTime</h1>
<p>See project <a href="http://code.google.com/p/dyndatetime/">home page</a> for details.</p>
<form action="/nothing/to/post.to">
<div>
<h3>Default with no options</h3>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#dateDefault").dynDateTime(); //defaults
});
</script>
<input type="text" name="dateDef" id="dateDefault"/>
<hr/>
<h3>Bind to multiple inputs in one go</h3>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#multi input").dynDateTime({
button: ".next()" //next sibling
});
});
</script>
<div id="multi">
<input type="text" name="dateA"/>
<button type="button">PICKER</button>
<br/>
<input type="text" name="dateB"/>
<button type="button">PICKER</button>
<br/>
<input type="text" name="dateC" value="2001/09/11"/>
<button type="button">PICKER</button>
<br/>
</div>
<hr/>
<h3>Using time, custom format, display output, and different pop-up location</h3>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#dateTimeCustom").dynDateTime({
showsTime: true,
ifFormat: "%Y/%m/%d-%H:%M",
daFormat: "%l;%M %p, %e %m, %Y",
align: "TL",
electric: false,
singleClick: false,
displayArea: ".siblings('.dtcDisplayArea')",
button: ".next()" //next sibling
});
});
</script>
The selected date is <span class="dtcDisplayArea"></span> <br/>
<input type="text" name="dateTimeCust" id="dateTimeCustom"/>
<button type="button">PICKER</button>
<hr/>
<h3>Flat example</h3>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#dateFlat").dynDateTime({
flat: ".next()",
debug: false
});
});
</script>
<input type="text" name="dateDef" id="dateFlat" value="2001/09/11"/>
<div style="float: left;"> </div>
<hr style="clear: both;"/>
</div>
</form>
<p>
<a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Strict" height="31" width="88" />
</a>
</p>
</body>
</html>
http://www.mechanicalmarksy.com/hosted/toolman/dyndatetime/example.html
crossdomain global.cs
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
System.Web.Routing.RouteTable.Routes.Add(new System.ServiceModel.Activation.ServiceRoute("",new System.ServiceModel.Activation.WebServiceHostFactory(), typeof(System.Web.Services.Description.Service)));
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
EnableCrossDmainAjaxCall();
}
private void EnableCrossDmainAjaxCall()
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin","*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods",
"GET, POST");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers",
"Content-Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age",
"1728000");
HttpContext.Current.Response.End();
}
}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
</script>
using System.ServiceModel.Activation;
[AspNetCompatibilityRequirements
(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
System.Web.Routing.RouteTable.Routes.Add(new System.ServiceModel.Activation.ServiceRoute("",new System.ServiceModel.Activation.WebServiceHostFactory(), typeof(System.Web.Services.Description.Service)));
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
EnableCrossDmainAjaxCall();
}
private void EnableCrossDmainAjaxCall()
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin","*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods",
"GET, POST");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers",
"Content-Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age",
"1728000");
HttpContext.Current.Response.End();
}
}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
</script>
using System.ServiceModel.Activation;
[AspNetCompatibilityRequirements
(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
Tuesday, May 17, 2011
fancy box code
fancy box code
<%-- fancybox--%>
<script src="fancybox/jquery.mousewheel-3.0.4.pack.js" type="text/javascript"></script>
<script src="fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>
<link href="fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />
<!--fancy box-->
1) $(document).ready(function () {
$("#siginid").fancybox({
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'speedIn': 600,
'speedOut': 200,
'overlayShow': false
});
});
2)<a id="siginid" href="#signinhref">Sign in</a>
3)<div id="fancy" style="display:none">
<div id="signinhref">
<table>
<tr><td>Userid</td><td><input id="txtuserid" type="text" /></td></tr>
<tr><td>Password</td><td><input id="Text1" type="password" /></td></tr>
<tr><td><input id="btnsignin" type="button" value="Sign in" /></td></tr>
</table>
</div>
</div>
<%-- fancybox--%>
<script src="fancybox/jquery.mousewheel-3.0.4.pack.js" type="text/javascript"></script>
<script src="fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>
<link href="fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />
<!--fancy box-->
1) $(document).ready(function () {
$("#siginid").fancybox({
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'speedIn': 600,
'speedOut': 200,
'overlayShow': false
});
});
2)<a id="siginid" href="#signinhref">Sign in</a>
3)<div id="fancy" style="display:none">
<div id="signinhref">
<table>
<tr><td>Userid</td><td><input id="txtuserid" type="text" /></td></tr>
<tr><td>Password</td><td><input id="Text1" type="password" /></td></tr>
<tr><td><input id="btnsignin" type="button" value="Sign in" /></td></tr>
</table>
</div>
</div>
Monday, May 16, 2011
Sunday, May 15, 2011
Sedning email through serivce(wcf)
Through smtp
============== USING WCF SERVICE SENDING MAIL
email.From = new MailAddress("crmprocorp1@gmail.com");
email.CC.Add("crmprocorp1@gmail.com");
email.To.Add(txtemail);
float persentage = Convert.ToSingle(examscore) * 100 / 20;
string str= "<table><tr><td>Congratulations on attaining the following score. Your counselling is scheduled for this Saturday. Please call your</td></tr>";
str+= "<tr><td>Counsellor : Mr.David at 07799400500 to get your appointment time. Please get a copy of the score card/CV for the counselling.<br/><br/></td></tr>";
str+= "<tr><td>Regards,</td></tr>";
str+="<tr><td><b>Anuj T</b></td></tr><br/><br/>";
str += "<tr><td><b>Email</b> :anuj@cliniindia.com |<b> Phone</b> : 040 6555 0643 | <b> Website</b> :<a href='www.cliniindia.com'>www.cliniindia.com/info@cliniindia.com</a></td></tr>";
str += "<tr><td><b>Address</b> : CLINI INDIA, Swathi Plaza , Raj Bhavan Road ( Near Yashoda Hospital ), Somajiguda , Hyderabad - 500 082</td></tr>";
str += "</table>";
string gradstr = "";
if (grade == "Grade A")
{
// gradstr = "You have scored " + persentage.ToString() + "% for Grade A and secured a schorlarship for RS.30,000 ";
gradstr = str;
}
if (grade == "Grade B")
{
// gradstr = "You have scored " + persentage.ToString() + "% for Grade B and secured a schorlarship for RS.20,000 ";
gradstr = str;
}
if (grade == "Grade C")
{
// gradstr = "You have scored " + persentage.ToString() + "% for Grade C and secured a schorlarship for RS.10,000 ";
gradstr = str;
}
if (grade == "sorry")
{
// gradstr = "You have not attended the desired score for the scholarship,You may try again or call our counsellor at 040- 6555 0643.";
gradstr = str;
//grade=
}
StringBuilder sb1 = new StringBuilder();
sb1.Append("<html><head><title></title></head><body><table>");
sb1.Append(" Dear " + txtname + ", <br/><br/> " + gradstr + "<br/><br/>");
sb1.Append("<tr><td><br/></td></tr><tr><td>");
sb1.Append("<table>");
sb1.Append("<tr><td style='background-color:Green' colspan='2'></td></tr>");
sb1.Append("<tr><td colspan='2'><h2><b>CliniIndia Exam score card</b></h2></td></tr>");
sb1.Append("<tr><td><h4><b>Name</b></h4></td><td>" + txtname + "</td></tr>");
sb1.Append("<tr><td><h4><b>Date of exam</b></h4></td><td>" + DateTime.Now + "</td></tr>");
sb1.Append("<tr><td><h4><b>Score</b></h4></td><td>" + examscore + " out of 20</td></tr>");
sb1.Append("<tr><td><h4><b>Percentage</b></h4></td><td>" + persentage + "%</td></tr>");
//sb1.Append("<tr><td><h4><b>Grade</b></h4></td><td>" + grade + "</td></tr>");
sb1.Append("<tr><td style='background-color:Green' colspan='2'></td></tr>");
sb1.Append("<tr></table>");
sb1.Append("</td>");
sb1.Append("</tr></table></body></html>");
email.Body = sb1.ToString();
email.Subject = "Scholarship";
email.IsBodyHtml = true;
email.Priority = MailPriority.Normal;
string err = "";
SmtpClient smtpClient = new System.Net.Mail.SmtpClient();
try
{
smtpClient.Send(email);
}
catch (SmtpFailedRecipientException ex)
{
err = ex.Message;
}
catch (SmtpException ex)
{
err = ex.Message;
}
return true;
IN APP.CONFIG
==============
<!--<smtp from="bhaskar@crmprocorp.com" deliveryMethod="Network">
<network defaultCredentials="false" enableSsl="false" host="mail.crmprocorp.com" port="25" password="password" userName="bhaskar@crmprocorp.com" />
</smtp>-->
<smtp from="crmprocorp1@gmail.com" deliveryMethod="Network">
<network defaultCredentials="false" enableSsl="false" host="smtp.gmail.com" port="587" password="Pu99et@1" userName="crmprocorp1@gmail.com" />
</smtp>
============== USING WCF SERVICE SENDING MAIL
email.From = new MailAddress("crmprocorp1@gmail.com");
email.CC.Add("crmprocorp1@gmail.com");
email.To.Add(txtemail);
float persentage = Convert.ToSingle(examscore) * 100 / 20;
string str= "<table><tr><td>Congratulations on attaining the following score. Your counselling is scheduled for this Saturday. Please call your</td></tr>";
str+= "<tr><td>Counsellor : Mr.David at 07799400500 to get your appointment time. Please get a copy of the score card/CV for the counselling.<br/><br/></td></tr>";
str+= "<tr><td>Regards,</td></tr>";
str+="<tr><td><b>Anuj T</b></td></tr><br/><br/>";
str += "<tr><td><b>Email</b> :anuj@cliniindia.com |<b> Phone</b> : 040 6555 0643 | <b> Website</b> :<a href='www.cliniindia.com'>www.cliniindia.com/info@cliniindia.com</a></td></tr>";
str += "<tr><td><b>Address</b> : CLINI INDIA, Swathi Plaza , Raj Bhavan Road ( Near Yashoda Hospital ), Somajiguda , Hyderabad - 500 082</td></tr>";
str += "</table>";
string gradstr = "";
if (grade == "Grade A")
{
// gradstr = "You have scored " + persentage.ToString() + "% for Grade A and secured a schorlarship for RS.30,000 ";
gradstr = str;
}
if (grade == "Grade B")
{
// gradstr = "You have scored " + persentage.ToString() + "% for Grade B and secured a schorlarship for RS.20,000 ";
gradstr = str;
}
if (grade == "Grade C")
{
// gradstr = "You have scored " + persentage.ToString() + "% for Grade C and secured a schorlarship for RS.10,000 ";
gradstr = str;
}
if (grade == "sorry")
{
// gradstr = "You have not attended the desired score for the scholarship,You may try again or call our counsellor at 040- 6555 0643.";
gradstr = str;
//grade=
}
StringBuilder sb1 = new StringBuilder();
sb1.Append("<html><head><title></title></head><body><table>");
sb1.Append(" Dear " + txtname + ", <br/><br/> " + gradstr + "<br/><br/>");
sb1.Append("<tr><td><br/></td></tr><tr><td>");
sb1.Append("<table>");
sb1.Append("<tr><td style='background-color:Green' colspan='2'></td></tr>");
sb1.Append("<tr><td colspan='2'><h2><b>CliniIndia Exam score card</b></h2></td></tr>");
sb1.Append("<tr><td><h4><b>Name</b></h4></td><td>" + txtname + "</td></tr>");
sb1.Append("<tr><td><h4><b>Date of exam</b></h4></td><td>" + DateTime.Now + "</td></tr>");
sb1.Append("<tr><td><h4><b>Score</b></h4></td><td>" + examscore + " out of 20</td></tr>");
sb1.Append("<tr><td><h4><b>Percentage</b></h4></td><td>" + persentage + "%</td></tr>");
//sb1.Append("<tr><td><h4><b>Grade</b></h4></td><td>" + grade + "</td></tr>");
sb1.Append("<tr><td style='background-color:Green' colspan='2'></td></tr>");
sb1.Append("<tr></table>");
sb1.Append("</td>");
sb1.Append("</tr></table></body></html>");
email.Body = sb1.ToString();
email.Subject = "Scholarship";
email.IsBodyHtml = true;
email.Priority = MailPriority.Normal;
string err = "";
SmtpClient smtpClient = new System.Net.Mail.SmtpClient();
try
{
smtpClient.Send(email);
}
catch (SmtpFailedRecipientException ex)
{
err = ex.Message;
}
catch (SmtpException ex)
{
err = ex.Message;
}
return true;
IN APP.CONFIG
==============
<!--<smtp from="bhaskar@crmprocorp.com" deliveryMethod="Network">
<network defaultCredentials="false" enableSsl="false" host="mail.crmprocorp.com" port="25" password="password" userName="bhaskar@crmprocorp.com" />
</smtp>-->
<smtp from="crmprocorp1@gmail.com" deliveryMethod="Network">
<network defaultCredentials="false" enableSsl="false" host="smtp.gmail.com" port="587" password="Pu99et@1" userName="crmprocorp1@gmail.com" />
</smtp>
Saturday, May 7, 2011
generate uniqid lilke gudi using jqery
function generateGuid() {
var result, i, j;
result = '';
for (j = 0; j < 32; j++) {
if (j == 8 || j == 12 || j == 16 || j == 20)
result = result + '-';
i = Math.floor(Math.random() * 16).toString(16).toUpperCase();
result = result + i;
}
alert(result);
}
var result, i, j;
result = '';
for (j = 0; j < 32; j++) {
if (j == 8 || j == 12 || j == 16 || j == 20)
result = result + '-';
i = Math.floor(Math.random() * 16).toString(16).toUpperCase();
result = result + i;
}
alert(result);
}
Subscribe to:
Posts (Atom)