Thursday 2 November 2017

required permissions cannot be acquired iis7 ?

required permissions cannot be acquired iis7  ?

Ans)  Following the Steps are resolved the issue otherwise see the below link

Go to IIS.
Right click on the website folder and see it's app pool.
Right click on the app pool and go to advanced settings.
In the process model section set load user profile to true

                            (Or)


Refer the below link
https://stackoverflow.com/questions/1846816/iis7-failed-to-grant-minimum-permission-requests

Monday 14 March 2016

Saturday 23 January 2016

Display column in DataGridView as password input type

    private void Form1_Load(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Uname", typeof(System.String));
            dt.Columns.Add("Password", typeof(System.String));

            DataRow dr = dt.NewRow();
            dr[0] = "venkatesh";
            dr[1] = "venkatesh@123";
            dt.Rows.Add(dr);
            dataGridView1.DataSource = dt;
        }

        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                if (e.Value != null)
                {
                    string str = new string('*',e.Value.ToString().Length);

                    e.Value = str;
                }
            }
        }

Thursday 7 January 2016

How To Get ImageFormates in c#

Import Namespace : Using  System.Drawing.Imaging;


// Get ImageFormates


string[]  imageFormates=    ImageCodecInfo.GetImageEncoders().AsEnumerable().Select(x=>x.FilenameExtension).ToArray();

Tuesday 22 December 2015

Get Excell Sheets in Excell File

 public List<string> ListSheetInExcel(string filePath)
        {
         
            OleDbConnectionStringBuilder sbConnection = new OleDbConnectionStringBuilder();
            String strExtendedProperties = String.Empty;
            sbConnection.DataSource = filePath;
            if (Path.GetExtension(filePath).Equals(".xls"))//for 97-03 Excel file
            {
                sbConnection.Provider = "Microsoft.Jet.OLEDB.4.0";
                strExtendedProperties = "Excel 8.0;HDR=Yes;IMEX=1";//HDR=ColumnHeader,IMEX=InterMixed
            }
            else if (Path.GetExtension(filePath).Equals(".xlsx"))  //for 2007 Excel file
            {
                sbConnection.Provider = "Microsoft.ACE.OLEDB.12.0";
                strExtendedProperties = "Excel 12.0;HDR=Yes;IMEX=1";
            }
            sbConnection.Add("Extended Properties", strExtendedProperties);
            List<string> listSheet = new List<string>();
            using (OleDbConnection conn = new OleDbConnection(sbConnection.ToString()))
            {
                conn.Open();
                System.Data.DataTable dtSheet = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
             
                foreach (DataRow drSheet in dtSheet.Rows)
                {
                    if (drSheet["TABLE_NAME"].ToString().Contains("$"))//checks whether row contains '_xlnm#_FilterDatabase' or sheet name(i.e. sheet name always ends with $ sign)
                    {
                        listSheet.Add(drSheet["TABLE_NAME"].ToString());
                    }
                }
            }
            return listSheet;
        }

Image Compression

 Bitmap bmp1 = new Bitmap(@"c:\TestPhoto.jpeg");
            ImageCodecInfo jpgEncoder = GetEncoder(System.Drawing.Imaging.ImageFormat.Jpeg);        
            System.Drawing.Imaging.Encoder myEncoder =
            System.Drawing.Imaging.Encoder.Quality;
            EncoderParameters myEncoderParameters = new EncoderParameters(1);
            EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 50L);
            myEncoderParameters.Param[0] = myEncoderParameter;
            bmp1.Save(@"c:\TestPhotoQualityFifty.jpeg", jpgEncoder, myEncoderParameters);
            myEncoderParameter = new EncoderParameter(myEncoder, 100L);
            myEncoderParameters.Param[0] = myEncoderParameter;
            bmp1.Save(@"c:\TestPhotoQualityHundred.jpeg", jpgEncoder, myEncoderParameters);    
            myEncoderParameter = new EncoderParameter(myEncoder,20L);
            myEncoderParameters.Param[0] = myEncoderParameter;
            bmp1.Save(@"c:\TestPhotoQualityZero.jpeg", jpgEncoder, myEncoderParameters);




 private ImageCodecInfo GetEncoder(System.Drawing.Imaging.ImageFormat format)
        {

            ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();

            foreach (ImageCodecInfo codec in codecs)
            {
                if (codec.FormatID == format.Guid)
                {
                    return codec;
                }
            }
            return null;
        }

Thursday 26 February 2015

member names cannot be the same as their enclosing type C#

Example:

Public  Classs  LoginDetails
{
       public LoginDetails()
      {
               //           Constructor
      }
     
      Public Void LoginDetails(string Uname,string Pwd )
      {
           // User defined method
      }
     
 }

Note: It Gives An Error .

Your class Name is  LoginDetails so this method can't also be named LoginDetails . You will have to change the name of the LoginDetails method to something else to make this code compile.