Twitter Feed Popout byInfofru

TfsOlapReportDS Report Service Error

Well, I only use Reporting Services (RS) with Team Foundation server (TFS) as yet, but blieve me either the integration of RS with TFS is not good or there is some great problem with RS. It create lots of problems, some days back when we move our server from WorkGroup to Domain. We start getting this error. TfsOlapReportDS Report Service ErrorSo, as usual it requires much try and lots of efforts to solved. I attemp following procedure to get ridd of it.Try 1
1. Open SQL Server Management Studio 2. Select Analysis Services from Server type3. Select your server. It will connect you and will show you object explorer.4. Drill Down to the database you will find TfsWarehouse 5. Select Roles - > Select TfsWarehouseDataReader6. A property popup will appear, Select Membership from the left panel.7. Verify that TFS Service account is listed here, as well as all the users who have access to the reporting services of TFS are listed here (Users might be in groups).
Try 2
1. Connect to http://reportserver/reports2. Click TfsOlapReportDS3. Check Enable this data source4. Select Connection Type to Microsoft Analysis Services 5. Verify the Connection string which is entered is correct, if it is not there. write it. Data source=name;initial catalog=TfsWarehouse6. Select Credentials stored securely in the report server and Add TFS Service Account user and password here. 7. Check "use as Windows credentials when connecting to the data source".8. Click Apply.
Both the tricks, didn't work really so I move to Event Log and there is another issue. Windows is regularly logging an error called
Microsoft.TeamFoundation.VersionControl.Adapter: Unable to access the following folder: C:\\Program Files\\Microsoft Visual Studio 2008 Team Foundation Server\\Web Services\\Warehouse\\VersionControl_Data
So to solve this issue Try 3
1. Go to C:\\Program Files\\Microsoft Visual Studio 2008 Team Foundation Server\\Web Services\\Warehouse2. See if you have any folder with the name of "VersionControl_Data".3. If there is not any folder then create one and Grant Read / Write Access to the TFS Service Account.
In my case the folder was not there, so I create one and Error Logging disappears. Atleast TFS is running fine but still the issue of Reporting Services is there. So I went back to the reporing portal Try 4
1. Connect to http://reportserver/reports2. Click TfsReportDS3. Check the same thing which we had for "TfsOlapReportDS" except that it will connect to Microsoft Sql Server rather Analysis Services. 4. In my case the connection string was empty, I just fill that Data source=name;initial catalog=TfsWarehouse5. Please make sure to re-enter password at the bottomg of page, as it gets expires when you change any thing in the form and press submit without entering the password again.
So, These four attempts restore our Reporting services from this error. Also, note in most of the cases when reporting services is not working fine, you will not be able to create new project in Team System. Don't take Reporting Services lightly, It is really important for Team System

Setting up sharepoint same site for another URL

While we were in the process of moving to the live server (with static ip address). I realize that the sharepoint site is not working when I access it through IP Address (For the outer network public). It is running fine from the local network both by dns or by name.

So I diagnose, I need to register the new URL (with new ip address) somewhere in the sharepoint.

1 . Let's move to share point central administration
2. Goto Operations then goto Alternate Access Mappings.

You might see the following screen.

sc_editzone_1.jpg

Click Edit Public URL's.

sc_editzone_2.jpg

Click the circle box.

sc_editzone_3.jpg

Select your sharepoint site.

sc_editzone_4.jpg

Press Save and thats it.

Microsoft enterprise Library Data Block

Hey geeks,Well ... It is always difficult to understand someone's code which you have writted already. I have written a Library called Data Aceess Tools, which is more like a data block of enterprise library. However, enterprise library is quit advance then Data Aceess Tools, which make my interest to work on enterprise library. so let me give you step by step instrucion. now please dont ask me to define the installations step thats too simple, we have been doing the same installation from childhood. so lets get down to the business.Step 1 (Adding Enterprise Library to Project):Geeks, before I start I would like to remind again that this article is will provide only Data Block information that is why we need to register two dlls in out project.1) Microsoft.Practices.EnterpriseLibrary.Data.Sql & Microsoft.Practices.EnterpriseLibrary.Data.Yes, It is sure very easy. so lets move on.Step 2 (Coding):first of all import the foloowing libraries in the class
Imports Microsoft.Practices.EnterpriseLibrary.Data.SqlImports Microsoft.Practices.EnterpriseLibrary.Data
Now for creating the connection, Create Database object and pass the connection String in the method.
Dim db As Database = DatabaseFactory.CreateDatabase("Database")
Well in our case we are trying to access Stored procedure, so lets start with that.
Dim DbCommand As Common.DbCommand = db.GetStoredProcCommand(“Sp_writeData“)
now lets add parameters for stored procedure.
db.AddInParameter(DbCommand, "@UserID", DbType.Int32, reportId)db.AddInParameter(DbCommand, "@Age", DbType.Int32, reportJobId)db.AddInParameter(DbCommand, "@MisInfo", DbType.Xml, parameterXml)
Okay let me define these lines. db is the name of database object by which we are adding parameters. DbCommand is the name of command Object in which we are adding parameters.Now if this stored procedure returning you result then do the following:
db.ExecuteScalar(DbCommand)
or
Dim dr as SqlClient.SqlDataReader = db.ExecuteReader(DbCommand)
or
Dim ds as DataSet = db.ExecuteDataSet(DbCommand).
here it is , now you got the result in your recordset ..... do whatever you want to . (with database) :)

Dotnet Interview Question Series 2

Q1)What is View State?

Ans)It contains state of control, which asp.net runtime reloaded when the post back operation occurs.

Q2)Can you read the View State?
Ans) Yes, For Example:
Response.write(viewstate("myname"))

Q3)Can we disable the view state application wide?
Ans) by specifying the followig line in web.config

Q4)Can we disable it on page wide?
Ans)Yes,by specifying Viewstate="false" in page directive.
<% Page viewstate="false"%>

Q5)can we disable it for a control?

Ans)Yes,by specifying Viewstate="false" in control markup.

Q6)Any idea of Enterprise library?

Ans) Heaven, Enterprise Library is a library from Microsoft Patterens & Practices which provide you with the different application block example
Data Access
Security
Logging
Exception
and much more.
It actually gives you classes to implement different re-useable functionalities.

Q7)What is web service?

Ans) We can assume a web service as a method over the web, It actually takes the parameter and give the result in the XML format for independablity.furthermore, It use SOAP formatted XML enavlops and use WSDL for interfacing.

Q8)What is WSDL?

Ans) It is XML based language which provide a model for describing Web Service, meaning that it gives description how to communicate with Web serice. It use in the combination of XML Schema and SOAP.

Q9)Can a web service be only developed in asp.net?

Ans) No, We can also develop webservices using Java (JSP).

Q10)Can we use multiple web services from a single application?

Ans) Yes...

Q11)can we call a web service asynchronously?

Q12)Can a web service be used from a windows application?

Ans) Yes, the speciliaty of windows service is that it can be called from any where, either windows application or mobile application.

Q13)What do we need to deploy a web service?

1.At the command prompt:

WSDL http://ip address ofthe site/WebService/MathService.asmx /n:NameSp /out:FileName.cs]
-This will create a file called FileNmame.cs .

WSDL -> WebServices Description Language (This is an application available at C:\\Program

Files\\Microsoft.NET\\FrameworkSDK\\Bin)

NameSp -> Name of the NameSpace which will be used in client code for deploying the

webservice.

2.Compilation

CSC /t:library /r:system.web.dll /r:system.xml.dll CreatedFile.cs

This will create a dll with the name of the public class of the asmx file.( In our case, it

is "AddNumbers.dll" )

CSC is an application available at C:\\WINNT\\Microsoft.NET\\Framework\\v1.0.2914

3.Put the dll file inside WWWRooT\\BIN [Create a BIN Folder in WWWRoot]

Q14)What is the significance of web.config?

Ans) It is the most significant part of any application, actually it contain the configuration which can be readable for runtime enviroment and manage the application accordingly.

Q15)Can we have multiple web.config files in a sigle web project?

Ans) Sure, we can have as different web.config file in every single folder for example If I want all the pages "/Presentation" reside in this folder use different database, I write another web.config file and put it under "/presentation". furthermore, we have a default web.config file on the root of web application. if any folder doesnot have its own web.config runtime automatically read the default one for configuration. and evenif there
is no default web.config file located it read machine.config to get the configuration syntax

Q16)Can we have more then one configuration file?
Ans) Yes the method will be same as above


Q17)Type of Authentications?

Ans) Windows, Forms, and Passport

Q18)Can we have multiple assemblies in a single web project?

Ans) The default architecture of .net framework doesnot allow you to create multiple
assemblies of a single project, but we can achieve this target as mentioned here.
http://www.codeproject.com/aspnet/VSMaker.asp
but you see this is not the appropriate way, if one really wants to split the project then I would reccommend to create seprate class library for every module, instead of generating
a dll for every page as mention in the link given above.

Q19)What is GAC?

Ans) GLOBAL ASSEMBLE CACHE, It is a folder located in %system%\\assembly. It is a global
cache for assemblies. Any DLL located in this folder can have full access of using CLR.

Q20)What is machine.config?

Ans) This is configuration file located in c:\\Windows\\Microsoft.NET\\Framework\\{Version Number}\\CONFIG. It holds the information about the dlls, proxy setting and lot more stuff.

Q21)What different types of session state Management we have in asp.net?

Ans) There are following three ways of state managment.
A) Sessions
B) Query String
C) Cookie

Q22)What are cookies?

Ans) It is a small piece of information, residing on client side for the sesssion managment. since web is a connection less medium that is why we need a cookie to persist the connection information.

Q23)What is Cache?

Ans) well caching is a process of storing objects in memory for a specified time period. instead of getting connection to the database and get the new results caching store result in memory and use those results to display And after the time expire it gets the new result from the database and again store in the memory.
we can set cache of the page by writing following directive.
<%@OutputCache Duration="60" VaryByParam="none" %>

Q24)What is AJAX?

It is a programming technique which use to make web pages more responsive by exchanging small amount of information in the way that user dont get idea for it, and instead of page reload or refresh it gets the data from the server.typically it uses the following combination.
HTML / CSS, DOM (Client side scripting) and XMlHttpRequest object

Q25)Is AJAX a language?

Ans) No it is an efficient use of different languages, it is a technique.

Q26)What is the difference between syncronus and asyncronus?

Ans) well synchronus is a connection maintained medium, meaning that connection is maintained between until the work finish. Cell phone Call is a best example for that. I Make a call to my friend now I am connected to him, and the connection is remain established until I disconnect the line whereas asyncronus is a connectionless medium in which we we establish connection just to pass parameter, and then get disconnected. Think about SMS, I connnect to my firnd cell phone just for a second to leave a message, as soon as message sent connection will destroy.


Q27)What is an Assembly?

Ans) Assembly contain inermediate language code which can be execute by CLR, complilers of differnet .net languages such as VB.net , C# generate IL Code in assembly which then can use by CLR.
There are two types of assemblies, (EXE) and (DLL)

Q28)Can an assembly contains more then one classes?

Ans) Yes,

Q29)What is strong name?

Q30)What is the difference b/w client and server side?

Ans) Client is one who is requesting services where as service is providing services.

Q31)What we need for the deployment of a asp.net we application?

Ans) Any webserver that support .net framework. commonly, we use IIS to deploy asp.net application. We use aspnet_regiis (.net command prompt) to install .net framework on any IIS.

Q32)what is the purpose of IIS?

Ans) Internet Information Server, It is a web server that help us to run dynamic web sites.

Q33)Difference between http and https?

Ans) Http is a typical protocol used for data travelling over the web, It is not secure. where as Https is a secure

Q34)what is purpose of aspnet_wp.exe ?

Ans) This is a process used by IIS to execute asp.net application.

Q35)what is an ISAPI filter?

Ans) Internet server Application Programming Interface, It must be written is C++ and the compiled in DLL which then registered in IIS to run on the web server.

Q36)what do you mean by HTTP Handler?

Ans) It is a .net Componenet that implements System.Web.IHTTPHandler interface, any class that inherit this interface can be work as a target of HTTP Request, For HTTPHandler to work we need to define a following line in config file as well or if you ever open machine.config file you will get the following lines which are responsible for showing different file type.

. . . . . .
. . . . . .

Q37)What is the purpose of Global.asax?

Ans) It is an Asp.net Application file, it contains the code for responding to application level and session level events raised by asp.net application.

Q38)What is the significance of Application_Start/Session_Start/Application_Error?

Ans) Application_Start fires whenever the application start or you re-upload bin (dlls) where as session_start is specific for a user means if a new session create for a user this events fire. Application_Error is fire when any error occured.

Q39)What is the difference between the inline and code behind?

Ans) Inline code is written with HTML in <% %> where as code behind code is written in .aspx.vb file.


Q40)what is side by side execution?

Ans) We can run multiple version of .net framework on one system,for example currently I am running 3 versions of .net framework 1.0,1.1 and 2.0. this feature of microsoft known as side-by-side execution.

Q41)can we have two different versions of dot net frameworks running on the same machine?

Ans) That is what Side-by-Side executation is.

Q42)What is CLR? Difference b/w CLR and JVM?

Ans) Well, the basic difference between two is that CLR use intermediate language where as JVM use bytecode.

Q43)What is CLI?

Ans) It is the main component of .net framework, It provide Hight Level language Interoperablity means, Application written on C# can easily by integrated with vb.net. This Target is achieved with the help of CLI (Common Language Infrasructure). It also describe the following four aspects.
CTS (Commong Type System).
Meta Data
CLS (Common Language Specification).
Virtual Execution System (VES)

Q44)What is CTS?

Ans) It provide you with the base set of data type, A data type define by CTS can use in any of .net framework language. Furthermore, Every thing in CTS is an object, means every data type is derived from System.object.

Q45)Any idea of aspnet_regiis?

Ans) It is used to register asp.net in IIS, it can be access from .net Command Prompt or .net framework Directory.

Q46)Any idea of ASP NET State Service?

Ans) Well, Asp.net State service is off by default but In windows 2003 it is installed by default. It is used to manage session State on a computer.

Q47)What is the difference between stroed procedure and stored function in SQL?

Ans) There are following basic difference between them
Function can return a table variable where as sp cannot.
T-SQl ignore error in Sp and proceed to next line where as function stops.
You Can use sp in XML For Clause , but Function can't be used there


Q48)Can we have an updateable view in SQL?

Ans) no , they are read only.

Q49)What is connection pooling? how can we acheive that in asp.net?

Ans) Well, there is a pool for database connections, the moment when we request for database connection ADO.net check if there is a recent connection in the pool with the same connectionString, If it find, it used that otherwise create a new connection.We can use connection Pooling in asp.net by System.Data.SqlClient.SqlConnectionPoolManager furthermore, We can define pooling attribute in connection string
pooling=false|True
Min Pool Size=50
Max Pool Size=600

Q50)What is DataSet?

Ans)Dataset is like a recordset, when we get any result from datasource, dataset fill it self with the result and destroy the connection from datasource. It is also called disconnected datasource. It remove the over head of maintaining connection with the database, but can make application slow where there is large sum of results.

Q51)What is the difference between typed and untyped dataset?

Ans) As the name mention, untyped dataset are not structured where as typed dataset are keenly structure.
We need to do some extra coding but by that we can make our code look pretty and understandable.

Q52)What is the difference bewteen accessing the data throgh the dataset and datareader?

Ans)Dataset doesnot maintain connection with the datasource where as in data reader we explisitly need to close the connection. where as datareader is forward only and we have not such restriction in dataset.

Interview Questions Series 1

Q1) Describe the difference between a Thread and a Process?Ans) Process is a collection of multiple threads ans is a unit of allocation. whereas thread is a unit of execution which allow an application to run multiple task, multiple threads in a process share the same virtual memory.Q2)What is a Windows Service and how does its lifecycle differ from a “standard” EXE?Ans) Windows services are the long running Process and have no user interface and control by Service Control Manager. Windows Services can start when the os starts and all the logs of windows service maintain in Widnows Event Log. Q3)What is the difference between an EXE and a DLL?Ans) An Exe can run independently where as DLL need an executeable file(EXE) to perform any function. DLL is in Process file where as EXE is out Process file. Q4)What is strong-typing versus weak-typing? Which is preferred? Why?Ans) Strong type check the variable and data type as soon as possible usually at compile time where as Weak type reverse the situation means as late as possible at runtime. furthermore,the preference is depends upon what are you up to. If you are writing script then use weak typing and if you are writing application in which speed is really matters then I sugges you should do strong type.Q5)What are PDBs? Where must they be located for debugging to work?Ans)PDB is Program database file which contain the state information.It contains the debug information of assembly.Q6)What is FullTrust? Do GAC’ed assemblies have FullTrust?Ans) Fulltrust assemblies means your code is allowed to do any thing, All .net Permission granted. Yes GAC Have full trust permission because it reside on local hd but we can change that using CASPOL.Q7)Why is catch(Exception) almost always a bad idea?Ans) Well , being a programmer if a LOC expected to throw error then why dont we catch directly that specific exception for example instead of catch(Exception ex){it catches all the exception and perform accrodingly} we can catch(NullException ex) {It catches only NullException type} Good Idea.Q8) What is the difference between Debug.Write and Trace.Write? When should each be used?Ans) Debug.write only works in Debug mode whereas Trace.write works in both Debug and release mode.Q9) What is Reference Type and value Type?Ans) String is Reference Type.Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short,strut, uint, ulong, ushortValue types are stored in the StackReference type - class, delegate, interface, object, stringReference types are stored in the Heap

Exception handling in asp.net

Exception handling in asp.netFrankly speaking, handling exceptions is a real art, and especially when you break your application in different chunks of classes and forms. Some time it becomes unimaginably difficult to catch a simple error at runtime without managing exception block. When it comes to extendibility of the application unexpected errors become a night mare for programmers.After the request of many friends who are the regular reader of this blog , I have decided to share my approach to handle exception.Have look at the following piece of code.
Namespace CustomExceptionsPublic Class Exception_SqlInjectionInherits ExceptionPublic Sub New()MyBase.New(ConfigurationSettings.AppSettings("Exception_SqlInjection"))MyBase.Source = "SqlInjection"End SubEnd ClassEnd Namespace
In the above code I am doing a real simple thing. Let me just give you a quick Idea
Namespace CustomExceptionsPublic Class Exception_SqlInjectionInherits Exception
Creating a namespace called “CustomExceptions” and a class under that namespace which is called “Exception_SqlInjection”, Notice that this class is inheriting “Exception” class. It means that “Exception_SqlInjection” is now become an exception I can call it anywhere.
Public Sub New()MyBase.New(ConfigurationSettings.AppSettings("Exception_SqlInjection"))MyBase.Source = "SqlInjection"End SubEnd ClassEnd Namespace
Constructor of “Exception_SqlInjection” in which we are calling the base class and providing the error message. Notice that we are reading error messages from web.config file (App settings). And in the 3rd line we are simply giving the source to the base class which is a simple text “SqlInjection”The web.config for the code above will look like this.
 <configuration>  <appSettings>      <add key="Exception_SqlInjection" value="Sorry Kid !!! but you cannot apply sql injection here try some where else ...... and by the way better luck next time :)"/>       </appSettings></configuration>
   The moment when we call the above created exception the value of the key "Exception_SqlInjection" will be returned by exception as message.Now lets get down to the implementation of the above exception in a real life case. The scenario is I want to check the input of the user On Click event of Command Button.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickIf TextBox1.Text.IndexOf("'") <> -1 ThenThrow New CustomExceptions.Exception_SqlInjectionEnd IfEnd Sub
The above code is simply check the Textbox for the character “ ‘ “ and if it found any it will just throw a yellow page to browser.BINGOOOOOOO !!!!!The purpose of using exception is not to see the yellow screen every time, don’t be upset the next chunk of code will catch this exception and take the appropriate action. Here you might be thinking that why there is need to throw our own exception. So the answer is some time application may need to behave different on different occasions. That is why we use exceptions to throw our own error in a proper way.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickTryIf TextBox1.Text.IndexOf("'") <> -1 ThenThrow New CustomExceptions.Exception_SqlInjectionEnd IfCatch ex As CustomExceptions.Exception_SqlInjection'might you want the system to block this IP, or trace the IP or to email yourself about this attack.Response.Write("custom Exception :" & ex.Message)Catch ex As ExceptionResponse.Write("default Exception :" & ex.Message)End TryEnd Sub
Now you have created your own exception and catching it at the front end. Furthermore, if you like to create more exceptions just create another class with the namespace “CustomExceptions”.Example :
Namespace CustomExceptionsPublic Class Exception_SqlInjectionInherits ExceptionPublic Sub New()MyBase.New(ConfigurationSettings.AppSettings("Exception_SqlInjection"))MyBase.Source = "SqlInjection"End SubEnd ClassPublic Class Exception_WebConfigInherits ExceptionPublic Sub New()MyBase.New("The key value you are looking for is not available in the web.config this is the crucial problem please contact to administrator")End SubEnd ClassEnd Namespace
In the newly created class I pass a simple text instead to the base class instead of calling Web.Config file for error message.Cheers.

Writing XML File Dynamically

Hey Geeks,Writing xml file in .net application is quit general but I have noticed most of the people do this work in a loong and wrong (in my opinion) way. They write the xml file with the help of dataset which is more like a database...... Yes offcourse resource heavy. So let us make this operation quit simple and easy. consider the following XML Schema. We will write the same schema from our code to a local file.
XML Schema :
<?xml version=“1.0“ encoding=“utf-8“?><Items><Item><ItemId>3</ItemId><ProductName>Pine Apple</ProductName><Price>30 $</Price><Item><Items>
VB.net Code :
Dim XMLDoc As New XmlDocumentXMLDoc.Load(Server.MapPath("MyData.xml"))Dim XEle As XmlElement = XMLDoc.CreateElement("Item")Dim XTxt As XmlText'XMLDoc.DocumentElement.AppendChild(XEle)XEle = XMLDoc.CreateElement("ItemID")XTxt = XMLDoc.CreateTextNode("3")XMLDoc.DocumentElement.AppendChild(XEle)XMLDoc.DocumentElement.LastChild.AppendChild(XTxt)XEle = XMLDoc.CreateElement("ProductName")XTxt = XMLDoc.CreateTextNode("Meera")XMLDoc.DocumentElement.AppendChild(XEle)XMLDoc.DocumentElement.LastChild.AppendChild(XTxt)XEle = XMLDoc.CreateElement("Price")XTxt = XMLDoc.CreateTextNode("50 $")XMLDoc.DocumentElement.AppendChild(XEle)XMLDoc.DocumentElement.LastChild.AppendChild(XTxt)XMLDoc.Save(Server.MapPath("MyData.xml"))

Welcome to Aghausman.net

Finally,Today November 6, 2008. aghausman.net is getting live ........ Just need few hours to settle down the things.