Skip to main content

Posts

Showing posts from 2010

start or stop a service using batch file

To start a service and copy the files and stop the service in windows service . Please check the below code @echo off net stop " service name" echo service stopped XCOPY c:\books.xml D:\books.xml echo copied net start " service name" :end The  command net start " service name" will start the service, change the service name to your desirable  service to start The  command net stop " service name" will stop the service, change the service name to your desirable  service to stop XCOPY command will copy the file from source to target destination type all these command under a batch file and save it and then run it in command prompt It is assumed that the user's know, IIS, windows service

delete service in windows server 2008/server 2003/xp/ vista

How to delete a service in windows server 2008/server 2003/xp/ vista. Note: There are some services which are system specific and cannot be stopped, Be careful while deleting a service The command to delete the service is "sc delete " The above command executes in DOS prompt.  An error will will come when you execute this command: "[SC] OpenService FAILED 5:" To remove this error and to execute the command in good manner.  When you open the command prompt , run it as administrator and then type : "sc delete " This is how to delete the service Start/Stop the service  You  can also start the service by Control panel-->administrative tools--> Services Right Click on the selected service and start/stop it Ps Note: Before deleting a service in windows server 2008/server 2003/xp/ vista you should confirm the name of service and research in google the effect after you  delete a service. It is difficult to recall the service back...

Exception Cross-thread

Exception:- Cross-thread operation not valid: Control 'treeView' accessed from a thread other than the thread it was created on. I have kept treeview, You can replace it with control of your choice Solution   if (treeView.InvokeRequired)                     {                         this.Invoke((MethodInvoker)delegate()                         {                                                     ...

XSS- (cross site scripting)

To protect yourself from XSS cross site scripting . There are may techniques you can get from the Google search engine. There is an  another way in which you can block the "<"  in the user input so that no one can run the script. You can also filter add a filter or a escape character for the same"<" This will block the

Configure/Install PHP on IIS windows

Step 1 - Download Php from http://www.php.net/downloads.php In order to configure or install PHP on IIS, copy the php.ini file from the php directory to the windows directory. If there are any changes in the "PHP.ini" file.make sure the  copies of "PHP.ini" in windows and PHP folder are synchronized. Step 2 -  Goto IIS , Right click on the default website, select properties Step-3: Click on configuration Button,Goto Mapping Tab, Click on Add button and add the same as given in screenshot Step 4:-  Click on and then Close the IIS. Step 5:- Right Click on My Computer>>Select properties>>advance Tab>>select Environment variables Step 6:- Select Path from system variable and then add the path  to the PHP directory, Add a semicolon and then paste the path in variable value Step 7:- Add a New variable called PHPRC and give the variable value as path of php directory Step 8: - Create a file at the root of IIS and name it info.php and writ...

Dotnet Interview Questions and Answers

Does C# support multiple-inheritance? No.  Who is a protected class-level variable available to? It is available to any sub-class (a class inheriting this class).  Are private class-level variables inherited? Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited.   Describe the accessibility modifier "protected internal". It is available to classes that are within the same assembly and derived from the specified base class.   What's the top .NET class that everything is derived from? System.Object.   What does the term immutable mean? The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.   What's the difference between System.String and System.Text.StringBuilder classes? System.String is immutable.  System.StringBuilder was designed with the purpose of having a mutabl...

How to execute a query in Vb.net

strSQL="delete or insert or update * from tablename where condition" Try             cnSQL = New OleDbConnection(ConnectionString)             cnSQL.Open()             cmSQL = New OleDbCommand(strSQL, cnSQL)             cmSQL.ExecuteNonQuery()             drSQL.Close()             cnSQL.Close()             cmSQL.Dispose()             cnSQL.Dispose()         Catch Exp As OleDbException             MsgBox(Exp.Message, MsgBoxStyle.Critical, "Oledb Error")         Catch Exp As Exception             MsgBox(Exp.Message, MsgBoxStyle.Critical, "General Error") End Try

Get data from Clipboard

 if (Clipboard.GetDataObject().GetDataPresent(DataFormats.rtf))                    Label1.Text = Clipboard.GetDataObject().GetData(DataFormats.rtf).ToString();         else             Label1.Text = "There is no data in clipboard"; end if

Disable back button of browser

To disable the back button of browser (internet explorer, Microsoft) and to clear the cache write this two line of code in your pageload event Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.Cache.SetNoStore() The above two lines will clear cache of the last visited page. now on every page i think you must be checking that a particular user is logged in or not (with session variable). if user=session("usersession") then response.redirect("~/Next page.aspx", False) else response.redirect("~/Loginpage.aspx", False) endif

Generate PDF in dotnet

The best way to generate a pdf in .net is by using iTextsharp(very good library). With less stress in mind and without using any costly third party tool. Add reference top itextsharp dll in your project Add These two line using iTextSharp.text; using iTextSharp.text.pdf; Then in any event you can write these lines, I have written it in page load. protected void Page_Load(object sender, EventArgs e) { Document doc = new Document(); PdfWriter.GetInstance(doc, Response.OutputStream); doc.Open(); doc.Add(new Paragraph("This an ITextsharp generated PDF")); doc.Close(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment; filename=Sample.pdf"); Response.End(); } } Further tutorials can be found in http://itextsharp.sourceforge.net/

machine to machine

Error 1 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

LMS

There are many opensource LMS packages built in java and other languages. Check the list below Docebo eFront Dokeos Claroline ATutor ILIAS OLAT Sakai .LRN openelms Ganesha Choose the best

Increase upload file size in asp.net

If you want to upload a file of size more than 4 mb(default in asp.net), Follow these steps, Open web.config, Look out for tag and add these lines, You can change the execution timeout and maxrequestlength values depending on the need or your wish. The below example will upload 2 gb of data and the timeout is 10 minutes