Dynamically Change URL OF Web Service



During Web Application Development and Implementation There are Required to Dynamic Change Url Of Web Service.It's Can Be Done by Following Way.


Add Key In Web.Config With Web Service Path name So it's can be Later Change after Published.


  < add key="save_photo" value="http://comp-7/TestMobile/Service.asmx" > 


Now in Class Where you Are Using this Web Service Do Following


localhost.Service service_all = new localhost.Service();
service_all.Timeout = 10000;
service_all.Url = ConfigurationManager.AppSettings["save_photo"]; 



Enjoy !!!!!!!




Prev Post                                                      All Post                                                           Next Post





Posted in | 5 comments

System.Data.OleDb.OleDbDataAdapter internal error: invalid parameter accessor: 1 BADBINDINFO.

Problem :-  base    {"System.Data.OleDb.OleDbDataAdapter internal error: invalid parameter accessor: 1 BADBINDINFO."}    System.SystemException {System.InvalidOperationException}

Description And Solution :-

While Using Store Procedure in Access (With .Net) if you Are try to Used Output Parameter
                 like

       
       OleDbCommand sqlCmd = new OleDbCommand();
       AddParamToSQLCmd(sqlCmd, "@ReturnValue", OleDbType.Integer, 0,        
       ParameterDirection.ReturnValue, null);
       SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_USER_MigrantEmployeeID);
   

               Then System Throw Exception like  "+        base    {"System.Data.OleDb.OleDbDataAdapter internal error: invalid parameter accessor: 1 BADBINDINFO."}    System.SystemException {System.InvalidOperationException}" 

                 While Googling and My Personal R & D i Come on Point that You can not Used Output Paramter in MS Acess  While it's Not a Problem With SQL Server.
             

.
Prev Post                                                      All Post                                                           Next Post

Posted in | 0 comments

DateTime Format in SQL Server And MS Access

SQL SERVER 2000 
 
Convert DateTime Format in Sql Server Query.

   convert(varchar,emp.val_date,106) AS ind_date1    

106 is Format type Format Type List Give Below.



 
Style ID  Style Type    
0 or 100  mon dd yyyy hh:miAM (or PM)    
101  mm/dd/yy    
102  yy.mm.dd    
103  dd/mm/yy    
104  dd.mm.yy    
105  dd-mm-yy    
106  dd mon yy    
107  Mon dd, yy    
108  hh:mm:ss    
9 or 109  mon dd yyyy hh:mi:ss:mmmAM (or PM)    
110  mm-dd-yy    
111  yy/mm/dd    
112  yymmdd    
13 or 113  dd mon yyyy hh:mm:ss:mmm(24h)    
114  hh:mi:ss:mmm(24h)    
20 or 120  yyyy-mm-dd hh:mi:ss(24h)    
21 or 121  yyyy-mm-dd hh:mi:ss.mmm(24h)    
126  yyyy-mm-dd Thh:mm:ss.mmm(no spaces)    
130  dd mon yyyy hh:mi:ss:mmmAM    
131  dd/mm/yy hh:mi:ss:mmmAM  


MS Access :-

Format(a.sent_date,'dd-MMM-yyyy') as Email_Date
 
 
 
Prev Post                                                      All Post                                                           Next Post

Posted in | 1 comments

Encrypting and decrypting configuration sections in web.config

In Webapplication Configuration Section of Your Web Application Are Very Importent
Becuase it contain's your importent data like Connection Strings,Email id and Password
ect.. So We Need to Encrypt The Web.Config Perticular Section which contains
This Sensitive Information.it's can be done by following methods.

Encryption

Open your Visual 2005 Command Prompot and type Following Commands.

aspnet_regiis.exe -pe "appSettings
" -app  "/YourApplication Name"


So After Apply Encryption your App Setting Looks Like :-

< appSettings configProtectionProvider="RsaProtectedConfigurationProvider" >
     < EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
         xmlns="http://www.w3.org/2001/04/xmlenc#" >
         < EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" / >
         < KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#" >
             < EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#" >
                 < EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" / >
                 < KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#" >
                     < KeyName > Rsa Key < /KeyName >
                 < /KeyInfo >
                 < CipherData >
                     < CipherValue > H9WkRu3BZi7mrEv1Rz50SuN1uHi64mBKAlZKaU2FpwOjMc8Sp1eFqGmi5N
UssOxJgJUwIzp4OXdKaypAuvLG2lCwjosIS+cZXqwTmFQ6wn8Zqs8HSRMCh38Hrg
h+/fp5M4GNijinuDhzdPXMDZrAokU17lLXttq7N+Cl37v+tVI= 
< /CipherValue >
                 < /CipherData >
             < /EncryptedKey >
         < /KeyInfo >
         < CipherData >
             < CipherValue > WurKXXIZzc4lpEfzTmTUAqw638D08i1PZKQzinRUsW52TdI4rEJrAZm6xVRtfVry
M3E81Pri9ZmxR/lXofJFRFDWG7KH4hIXkYZ12yTQ5YaQzuz6C/dtZ5IpSyNfTMzHE+hV0cZJVhe
2X5v5pXM1op5V4pjxGNJ5WpVXoXrvRFkIWDKNGjU9WY3BtL1HTUyzfZL61jrmg23hqPodH
B4z6oh1aUy27Sa46IZh+r+rbqlRgCusol+V06N7WcCRJhgfgfMNRKsGX12nDWJRZnWnF9kg
7ko2CK75xIa+keqaTwdoIyRf02+/Dhee3Sc2n+uBXWyHbPI8pK7CA69btzEIvxoudj7PIIse
LgE8Un8+HMQvpXylosO3A2FgzwjgUKN7dGVV9NElCAS+xfAO0YdXY/mRaWi3eB8DTnKGtVNId7
hTBJddT01GCg8eBgX5NXqg173yXg3N5+P1a3+X00Szxo9JqasJmAfszFMR1aCSjxBnZJcMxSIn
ssBwV0w2VH4IhjKxbcORPzMsp01++41zpO9LJlpH27ZKZWhZt3GGPmBjZD/pmrPrKdLOIJiJfPbG < /CipherValue >
         < /CipherData >
     < /EncryptedData >
 < /appSettings >

 

Decryption

Write Down Following Command

aspnet_regiis.exe -pd "appSettings
" -app  "/You Webapplication Name"



So After Apply Descryption your App Setting Looks Like :-

< appSettings>
     < add key="idbadge" value="Data Source=Comp-7;Initial Catalog=idbadge;Integrated Security=true;" / >
     < add key="path_photo" value="http://comp-7/WebCam_Last1/Webcam_Test_1_0_0_20.application?idbadge=" / >
     < add key="CrystalImageCleaner-AutoStart" value="true" / >
     < add key="CrystalImageCleaner-Sleep" value="60000" / >
     < add key="CrystalImageCleaner-Age" value="120000" / >
 < /appSettings >




 



Prev Post                                                      All Post                                                           Next Post



Posted in | 0 comments

Encryption and Decryption Class In .Net.

Encryption and Decryption
There are many times Required to Descrypt Data and Stored
Data in Database Like User name and Password And 
When We Retrive That Data We Needs to Encrypt That Data.
Following Code Show How to Encrypt and Descrypt Data in Asp.Net



  public string Encry(string str)
    {
        string Tmp = "";
        int i;
        for (i = 0; i <= str.Length - 1; i++)
        {
            Char ch = Convert.ToChar((str.Substring(i, 1)));
            int asc_from_ch = ch;
            int asc2 = Convert.ToInt32(asc_from_ch) + 7;
            Char ch_from_asc = Convert.ToChar(asc2);
            Tmp = Tmp + ch_from_asc;

        }
        str = Tmp;
        return str;
    }

    public string Decry(String str)
    {
        string Tmp = "";
        int i;
        for (i = 0; i <= str.Length - 1; i++)
        {
            Char ch = Convert.ToChar((str.Substring(i, 1)));
            int asc_from_ch = ch;
            int asc2 = Convert.ToInt32(asc_from_ch) - 7;
            Char ch_from_asc = Convert.ToChar(asc2);
            Tmp = Tmp + ch_from_asc;

        }
        str = Tmp;
        return str;
    }

Call This Two Function From your Form.

ENJOY !!!!!!!!!!!!!!!!! 
 
 
Prev Post                                                      All Post                                                           Next Post

Posted in | 0 comments