Skip to content

Posts from the ‘Web Development’ Category

16
Oct

Sample Code for Send sms via Bulk SMS API Using C#

Signup from a bulk sms provider.and modify the code according to that http api link.
HTTP API for sending message to single no

http://domainname.com/sendsms?uname=yourUsername&pwd=yourPassword&senderid=yourSenderid&to=9444xxxxxx&msg=yourMessage&route=yourRoute

We Provide several api’s such as

  • HTTP API for sending message to multiple nos,
  • HTTP API for sending Scheduled message,
  • HTTP API for Checking credits left for given route,
  • HTTP API for Checking credits for all routes,
  • HTTP API for Checking Delivery report of sent SMS through HTTP API

Sample Code for Send sms via Bulk SMS API Using C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

    }
    public string mobile
    {
        get;
        set;
    }
    public string message
    {
        get;
        set;
    }
    public string username
    {
        get;
        set;
    }
    public string password
    {
        get;
        set;
    }
    public string domian
    {
        get;
        set;
    }
    public string sender
    {
        get;
        set;
    }
    public string route
    {
        get;
        set;
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        try
        {
            mobile = txtMobile.Text;
            message = txtMessage.Text;
            username = txtName.Text;
            password = txtPassword.Text;
            sender = txtSenderId.Text;
            domian = txtDomain.Text;
            route = txtrout.Text;
            string result = apicall("http://" + domian + "/sendsms?uname=" + username + "&pwd=" + password + "&senderid=" + sender + "&to=" + mobile + "&msg=" + message+ "&route=" + route);

            if (!result.StartsWith("Wrong Username or Password"))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Message Sent')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Message Sending Failed')", true);
            }

        }
        catch
        {
        }
    }
    public string apicall(string url)
    {
        HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(url);

        try
        {

            HttpWebResponse httpres = (HttpWebResponse)httpreq.GetResponse();

            StreamReader sr = new StreamReader(httpres.GetResponseStream());

            string results = sr.ReadToEnd();

            sr.Close();
            return results;

        }
        catch
        {
            return "0";
        }
    }
    protected void btnClear_Click(object sender, EventArgs e)
    {
        txtName.Text = "";
        txtPassword.Text = "";
        txtDomain.Text = "";
        txtSenderId.Text = "";
        txtMobile.Text = "";
        txtMessage.Text = "";
    }
}

 

sms
Demo                    Download

16
Oct

This Website is Under Construction Sample HTML code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Under Construction</title>
</head>
<body>
<br><br><br><br><br><br><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center">
<h1 style="margin:0;padding:0;font-family: trebuchet ms;">This Website is Under Construction.
<br><small style="color: #888;" align="center">Come Back Soon.</small>
</h1>
</td>
</tr>
</table>
</body>
</html>

Step 1: Just copy past the code to notepad,select save as from file menu,type file name as index.html ,select save as type as All Files.Then click save.

notepad
index

 

 

 

 

 

Step 2: After that upload the index.html file to root folder of hosting space.Hosting provider will provide the login details of hosting panel.
cpanel

 

 

 

Demo            Download

 

12
Oct

ASP.net using a form to insert data into an sql server connecting via Connection strings in web.config file

Requerment :

Need to code asp.net connect string in web config.

Need to execute insert query using this connection..

Benefit of Connection strings in web.config file

Get easy access to sql connection to all web page,easy to edit the connection.

Step to Do:

  • Step 1: Open a new blank project in Visual Studio.
  • Step 2: Setup the connection string in webconfig.
  • Step 3:Add a new web form an write the needed name space .
  • Step 4: Create a new object for sql connection ,then access the connection string in webconfig using the ConfigurationManager Class.
  • Step 5:Drag and drop the input element such as textbox to the form from the design view for receiving the data for execution of insert query.
  • Step 6:Create a new object for SqlCommand since we need to execute the sql query.
  • Step 7:Connecting the SqlCommand object to sql connection object ..Since SqlCommand need a valid connection credentials to Sql Server.
  • Step 8:Next we passing the query string to SqlCommand object using the SqlCommand.CommandText Property 
  • Step 9:Passing the the data from input form element (textbox) to SqlCommand object using the Parameters.AddWithValue Method.
  • Step 10: Since we need to execute the process only after we open the connection ,after opening  we write ExecuteNonQuery Method
  • Step 11: After executing the process we need to close the connection.
  • Step 12 : we place code block in Step 10 and step 11 in a try{  statements in  Step 10 and step 11 } (try-catch ),This is to handle Exception ,If any exception occur the code will move to catch section,skipping the try section.In our code we put to display the error details in catch section using a asp.net  label in web form.

 

Code in Web Config File :

 

<connectionStrings>
    <add name="CresignsysConnectionString" connectionString="Data Source=.;Initial Catalog=EEE_Dept;Persist Security Info=True;User ID=sa;Password=admin" providerName="System.Data.SqlClient"/>
  </connectionStrings>

C# Code For  insert data into an sql server 

 

 

Download the Code

————————————————————

Similar References

Connection string in web.config file

 

 

12
Aug

How to design a simple css template ?

hi,

Step 1 )Find a Slider..

Firstly we need to Search an image slider,So just search in Google as “free sliders” or check this website    we need a simple image slider so click on Basic jQuery Slider i use Basic jQuery Slider    http://basic-slider.com

Then Download the zip source of the image slider..

 

Create a folder in you computer named as “Template001”.. extract the zip folder there..

Step 2)Find a  css menu

Next we need a simple horizontal css menu,we can use this http://lwis.net/free-css-drop-down-menu/

Download the css menu

Again extract the css menu zip file  to the our Template001 folder in your computer..check this image below 

001

You can view the Demo image slider by opening the index.html file and an you can view css demo by opening the simple.horizontal.html file in our folder Template001

 

 

 

index.html page

slider

 

 

 

 

 

 

simple.horizontal.html page

css-menu

 

 

 

 

 

 

Step 3)

Create a new html file named as home.html .Copy the html element from index.html  and simple.horizontal.html  and past in to put new html page “home.html”

 

 

27
Jul

How to Backup/Restore your WordPress blog using Google Drive ?

Just install the UpdraftPlus Backup/Restore from plugins Directory (wordpress.org )

How to Install plugins.(login to admin panel of your blog.Go to Plugins->Add New ,Then Search “UpdraftPlus Backup” click on  Install Now link

After Installation go to Settings->UpdraftPlus Backup/Restore

Scroll down and find “Copying Your Backup To Remote Storage”

Choose your remote storage as Google Drive 

 

Go to  Google API Console  login using your Gmail id and password.

Go to API Access and click on “Create another client ID…” button

select Application type as “Web application” select “http” and add your blog url there ,then click on “(more options)”

You need to provide “Authorized Redirect URIs” For getting the Redirect URIs go to your worpress admin panel (Settings->UpdraftPlus Backup/Restore)

Scroll down you will find like this

http://myblogdomainname.com/wp-admin/options-general.php?page=updraftplus&action=updraftmethod-googledrive-auth

Copy and past to “Authorized Redirect URIs” in Api console  then click on “Create client ID” button

Then you will get

Client ID for web applications

Client ID:
*******************.apps.googleusercontent.com
Email address:
********************@developer.gserviceaccount.com
Client secret:
********************
Redirect URIs: http://myblogdomainname.com/wp-admin/options-general.php?page=updraftplus&action=updraftmethod-googledrive-auth
JavaScript origins: http://myblogdomainname.com

 Then come back to blog admin panel (Settings->UpdraftPlus Backup/Restore)

Provide “Google Drive Client ID:“,”Google Drive Client Secret:” form your  Google API console

Then click on Save Changes button

Now All settings are ok, now you can take back up by click” Backup Now” button   located at admin panel (Settings->UpdraftPlus Backup/Restore).

For restoring click “Restore” button   located at admin panel (Settings->UpdraftPlus Backup/Restore).