Sunday, August 18, 2013

Way to call a webservice

make an asp.net webservice   and write functions(eg:  sum(int a,int b) ) in it.

then run the project,,copy url in browser .

then create a new asp.net website...add webreference and copy paste the URL which was copied.

give a name(eg: webnew) to webservice..

then make an object of webservice such that....eg:  webnew.Service obj=new webnew.Service();


call function when necessary   such that....eg:   obj.sum();

Weather forcast

<table><tr><td><script src="http://www.bloguez.com/service/meteo/meteo.php?taille=195&adult=0&cat=histoire&ville=Cochin, India&code=INXX0032"></script></td></tr><tr><td align="center">
<a href="http://www.bloguez.com"><img src="http://www.bloguez.com/service/logo.png" border="0" alt="bloguez.com"></a>
<noscript>Service offert par <a href="http://www.bloguez.com">bloguez.com</a></noscript></td></tr></table>




YoutubeThumbnail video

<html>
<head>
<title>jYoutube - jQuery YouTube plugin demo</title>
<script src="jquery.js"></script>
<script src="jyoutube.js"></script>

<script type="text/javascript">
$(document).ready(function(){
    // Get youtube video thumbnail on user click
    var url = '';
    $('#submit').click(function(){
        // Check for empty input field
        if($('#url').val() != ''){
            // Get youtube video's thumbnail url
            // using jYoutube jQuery plugin
            url = $.jYoutube($('#url').val());
           
            // Now append this image to <div id="thumbs">
            $('#thumbs').append($('<img src="'+url+'" />'));
        }
    });
});
</script>

</head>
<body>

<div class="left">
<h1>Submit YouTube link</h1>
<form>
  <input type="text" name="url" id="url"/>
  <input type='button' value="Get Thumbnail" id="submit"/>
</form>

<p>Your YouTube video thumbs:</p>
<div id="thumbs"> </div>

</body>
</html>

Ramdom Password Generation - Asp.net C#

using System;
using System.Data;
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;

public partial class RandomPassword : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        string allowedChars = "";
        allowedChars = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,";
        allowedChars += "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,";
        allowedChars += "1,2,3,4,5,6,7,8,9,0,!,@,#,$,%,&,?";

        char[] sep ={ ',' };
        string[] arr = allowedChars.Split(sep);
               
        string passwordString = "";

        string temp = "";

        Random rand = new Random();
        for (int i = 0; i < Convert.ToInt32(txtPassLength.Text); i++)
        {
            temp = arr[rand.Next(0, arr.Length)];
            passwordString += temp;
        }

        txtPassword.Text = passwordString;
    }
}