Skip to main content

Posts

Showing posts from May, 2010

Managing State with ASP.NET and C#

Web Applications are disconnected in nature which means that there is no way for the browser to know who is using the application at present time. In classic Asp programming maintaining state was a headache for the  developers . They had to write alot of code to maintain state. But Asp.net model provides easy state  management . In this article we will see how we can persist state in multiple pages so the user is recognized by the browser. Preserving State in Web Applications There are number of ways that you can use to preserve  the State  of the Web Application. Here are some of the possible ways listed. 1) Using Cookies 2) Using Session States 3) Using Application States 4) Using HttpContext collection 5) Using ViewState These are only some ways of storing the state of the user as well as the application. In this article we will see few of them in detail. Using Cookies to maintain the state of the application Cookies are created on the server side but saved on the clie

Unable to open physical file - Operating system error 5: 5(error not found) Microsoft SQL Server: Error 5120

I am trying to attach a database to SQL 2005. This database has not previously been attached. I have only just installed SQL. I get the following message: Unable to open physical file "C:\ArrowSQL\Arr@Data\Arrow_data.mdf" Operating system error 5: "5(error not found)" (Microsoft SQL Server: Error 5120)". I have loaded SQL and the database fiel and directory with the same user acccount which is a local adminstrator ont hsi machine. I have checked that I have read/write access to the file. The machine runs Windows Vista Business. SQL has SP 2 loaded. Use the below script to find the sql service account Code Snippet declare  @sqlser  varchar ( 20 ) EXEC  master .. xp_regread @rootkey = 'HKEY_LOCAL_MACHINE' , @key = 'SYSTEM\CurrentControlSet\Services\MSSQLSERVER' , @value_name = 'objectname' ,  @value = @sqlser  OUTPUT PRINT   'Account Starting SQL Server Service:'  + convert ( varchar ( 30 ), @sqlser ) After getting the servi

Creating Web Services with C#

Introduction:  We all talk about  webservices , webservices can do this and webservices can do that. But when we are asked to make one, we hesitate. Maybe it's because we never made a webservice before, and all the time playing with Webforms and Windows Forms or even Console Applications. By the way, I love Console applications. In this article, I will show you how to create a simple webservice that is consumed by a Console application client. Motivation of the XML Web Services Most of the people does not understand that why we need a  web service  and make a wrong use of it. The main idea of a web service is to join two businesses together since they cannot join due to their graphical locations. Web Service is also used to link different systems together. The best thing about this is that the systems can be in different in nature. Meaning a web service enables a  windows application  to interact and communicate with the  linux  application. This is done by using XML as the tra