Friday, March 09, 2007

1. What is Crystal Report?
Ans: Crystal report is a report generation tool. Generally have interface with VB6. Crystal report basically generates dynamic data. You can format the data in whichever way you feel like.


2. Can we use Crystal report as a stand-alone application?
Ans: Generally we use
Crystal Reports with VB6. However we can make crystal report stand-alone application also. But for that limitation is for viewing the report user should have crystal reports installed on his/her PC.

3. How do we connect to the
database?
Ans: There are two ways of creating the report: -
Use crystal report built in query.
Use the tool ‘ Crystal SQL Designer’ provided by crystal report.
When you create report using crystal report built in query then it asks for the
data source name that you have created. When you run the report, then for the first time it will ask for the user id and password. After that it will store the same. When you create ‘.qry’ using ‘Crystal SQL’ Designer then at that time it will ask for the user id and password. When you run the report for the first time instead of asking for the user id and password it will ask for the ‘.qry’ file location. You can change the query location also. For that open the report, select ‘Set Location’ option in Database menu item, and set the location.

4. How do we format field?
Ans: For formatting any field just right click on it and you will get many options like ‘Format Field.’ ‘Browse field data’ etc. Click on ‘Format Field.’ You can align data, suppress, make it multiline, change the font size, style, and type, make it
hyperlink etc. If it is an amount field then you can display currency symbol also. Right click on the field select ‘Format Field’.

5. Can we give parameters to the report?
Ans: We can very well give parameters to the report. For creating parameters select ‘Parameter Field’ in Insert menu item. ‘Create Parameter Field’ dialog box will popped up, it will ask for the name of parameter, prompting text and datatype. Now when you run the report it will prompt for these parameters.

6.Can we create our own formulas in reports?
Ans: We can create our own formulas in reports. Select ‘Formula Field’ in Insert menu item. Write the formula in ‘Formula Editor’. Here you will get ‘Field Tree’, ‘Function Tree’, and ‘Operator Tree’, which will display the report fields, functions that are supported by crystal reports (like CDATE () etc.), operators (arithmetic, strings etc.) respectively.

7. Can we create report using more than one database?
Ans: We can create report using more than one database like Oracle, Access. Create data source name for both the databases. Select tables from them and create the report. Only restriction is if you use two databases then you cannot see the SQL generated by crystal reports.

8. Can we
export data of reports into other format like in world doc etc?
Ans: Generated data can be exported to word doc, or in
rich text format. Just click on ‘Export’ icon in the menu. Export dialog box will be popped up. It will ask for the ‘Format’ like comma-separated value (csv) etc and the ‘Destination’ like disk, application etc. After that it will ask for the file name and save the data. Only restriction is formatting of data will be lost, but crystal report will try to maintain as much formatting as it can.

9. Can we use our own SQL for creating a report?
Ans: We can also make our own query using ‘Crystal SQL Designer’ tool provided by SQL. Here you can insert your SQL statement as such. It will save this file as ‘.qry’ . And when you create a report instead of using ‘Database’ button use ‘Crystal SQL Statement’ button.

10. Can we edit SQL made by Crystal reports?
Ans: We cannot edit the SQL made by crystal reports. However we can view the SQL. For that select ‘Show SQL Query’ in Database menu item. Limitation is if you are using only one database. If you use two databases then you can’t even view the SQL prepared by crystal report.

11. Are there any limitations in crystal reports?
Ans: There are certain limitations in crystal reports. They are: -
If database is having field whose length is more than 255 characters, then you cannot make formula using that field. While exporting data formatting is lost. When you browse data just by right clicking on the field then it displays that is there in the database not the data selected by the query.

12. Can we suppress printing in crystal reports if 0 records are fetched?
Ans: Yes, we can suppress printing if no records are fetched. Select ‘Report Options’ in File menu item. ‘Report Options’ dialog box will pop up. In that there is one option ‘ Suppress printing if no records’ Check this option. If no records are found then nothing will be printed on the report.

13. What are the sections that we have in Crystal reports?
Ans: Report has got standard sections like ‘Page Header’, ‘Page Footer’, ‘Report Header’, ‘Report Footer’, and ‘Details’. However you can add other sections also. Select ‘Sections’ in the Insert menu item. You can insert group sections also. If you don’t want to show any section just right click on that section and suppress that.

14. Can we add any database field once we have chosen ‘Close’ button?
Ans: Yes, we can add any database field afterwards also. Select ‘Database Field’ in Insert menu item. If you are using crystal report built in query then it will display the tables that you have selected. And you can select whichever field you want to display on the report. But if you are using ‘.qry’ file then it will display Query and you can select only those field, which are there in the query.

15. Does Crystal Report support all the functions that we have in Oracle?
Ans: No, Crystal report does not support all the functions. Like Decode function is there in SQL but not there is crystal report. You need to convert that in crystal report format (in if and else etc.).
However if you use ‘.qry’ files then it take the SQL as such. There is no need of changing any syntax.

16. Can we use stored procedure for creating the report?
Ans: Yes, we can use stored procedure.

17. Is there any feature like summing total in crystal report?
Ans: Crystal reports provide features like grand total, sub-total, running total etc. You can select any of these features in Insert menu item. You can sum up records on the basis of each record or on change of group using ‘Running Total ‘ option in Insert menu item.

18. I am using two tables one is of access database and other is of oracle database, I am getting an error saying that ‘SQL odbc error’ what should I do?
Ans: If you are getting such an error then click the icon for ‘Report Expert’. It will give a warning saying that formatting will be lost. Ignore this you will get ‘Standard Report Expert’ dialog box. Reverse the links of access database table and it will work.

Wednesday, March 07, 2007

1 What base class do all Web Forms inherit from?
System.Windows.Forms.Form

2 What is the difference between Debug.Write and Trace.Write?

When should each be used? The Debug.Write call won't be compiled when the DEBUGsymbol is not defined (when doing a release build). Trace.Write calls will be compiled. Debug.Write is for information you want only in debug builds, Trace.Write is for when you want it in release build as well.

3 Difference between Anchor and Dock Properties?
Dock Property->Gets or sets which edge of the parent container a control is docked to. A control can be docked to one edge of its parent container or can be docked to all edges and fill the parent container. For example, if you set this property to DockStyle.Left, the left edge of thecontrol will be docked to the left edge of its parent control. Additionally, the docked edge of the control is resized to match that of its containercontrol.Anchor Property->Gets or sets which edges of the control are anchored to the edges of its container. A control can be anchored to one or more edges of its parent container. Anchoring a control to its parent ensures that the anchored edges remain in the same position relative to the edges of the parent container when the parent container is resized.


4 Can you write a class without specifying namespace?
Which namespace does it belong to by default??Yes, you can, then the class belongs to global namespace which has no name. For commercial products, naturally, you wouldn't want global namespace.

You are designing a GUI application with a windows and several widgets on it. The user then resizes the app window and sees a lot of grey space, while the widgets stay in place. What's the problem?

One should use anchoring for correct resizing. Otherwise the default property of a widget on a form is top-left, so it stays at the same location when resized.

5 How can you save the desired properties of Windows Forms application?

.config files in .NET are supported through the API to allow storing and retrieving information. They are nothing more than simple XML files, sort of like what .ini files were before for Win32 apps.

6 So how do you retrieve the customized properties of a .NET application from XML .config file?

Initialize an instance of AppSettingsReader class. Call the GetValue method of AppSettingsReader class, passing in the name of the property and the type expected. Assign the result to the appropriate variable.

7 Can you automate this process?

In Visual Studio yes, use Dynamic Properties for automatic .config creation, storage and retrieval.

My progress bar freezes up and dialog window shows blank, when an intensive background process takes over. Yes, you should've multi-threaded your GUI, with taskbar and main form being one thread, and the background process being the other.

8 What's the safest way to deploy a Windows Forms app?

Web deployment: the user always downloads the latest version of the code, the program runs within security sandbox, properly written app will not require additional security privileges.

9 Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio?

The designer will likely through it away, most of the code inside InitializeComponent is auto-generated.

10 What's the difference between WindowsDefaultLocation and WindowsDefaultBounds?WindowsDefaultLocation tells the form to start up at a location selected by OS, but with internally specified size. WindowsDefaultBounds delegates both size and starting position choices to the OS.

11 What's the difference between Move and LocationChanged?

Resize and SizeChanged? Both methods do the same, Move and Resize are the names adopted from VB to ease migration to C#.

12 How would you create a non-rectangular window, let's say an ellipse?

Create a rectangular form, set the TransparencyKey property to the same value as BackColor, which will effectively make the background of the form transparent. Then set the FormBorderStyle to FormBorderStyle.None, which will remove the contour and contents of the form.

13 How do you create a separator in the Menu Designer?

A hyphen '-' would do it. Also, an ampersand '&\' would underline the next letter.

14 How's anchoring different from docking?

Anchoring treats the component as having the absolute size and adjusts its location relative to the parent form. Docking treats the component location as absolute and disregards the component size. So if a status bar must always be at the bottom no matter what, use docking. If a button should be on the top right, but change its position with the form being resized, use anchoring.

15 How do you trigger the Paint event in System.Drawing?

Invalidate the current form, the OS will take care of repainting. The Update method forces the repaint.

16 With these events, why wouldn't Microsoft combine Invalidate and Paint, so that you wouldn't have to tell it to repaint, and then to force it to repaint?

Painting is the slowest thing the OS does, so usually telling it to repaint, but not forcing it allows for the process to take place in the background.

17 How can you assign an RGB color to a System.Drawing.Color object?

Call the static method FromArgb of this class and pass it the RGB values.

18 What class does Icon derive from?

Isn't it just a Bitmap with a wrapper name around it? No, Icon lives in System.Drawing namespace. It's not a Bitmap by default, and is treated separately by .NET. However, you can use ToBitmap method to get a valid Bitmap object from a valid Icon object.

19 Before in my VB app I would just load the icons from DLL. How can I load the icons provided by .NET dynamically?

By using System.Drawing.SystemIcons class, for example System.Drawing.SystemIcons.Warning produces an Icon with a warning sign in it.

20 When displaying fonts, what's the difference between pixels, points and ems?

A pixel is the lowest-resolution dot the computer monitor supports. Its size depends on user's settings and monitor size. A point is always 1/72 of an inch. An em is the number of pixels that it takes to display the letter M.

Tuesday, March 06, 2007

Wonderfull Blog for Biztalk Server to learn the Basics .
http://geekswithblogs.net/sthomas/archive/2005/12/29/64404.aspx
Speak the Basics of Share

By Darren Chervitz, CBS Market Watch


In the sometimes mundane world of investing, initial public offerings are shrouded in mystique.
The world of newly public companies, after all, remains off limits for most individual investors, although that is slowly beginning to change.
Apart from the sex appeal and the potential for big returns, however, investing in IPO’s is risky business. One simple fact anybody interested in jumping in the new issue market should know: Year in and year out, IPO’s have historically underperformed the broader market.
Obviously, investors need to get beyond the allure and hype of IPO’s and become educated about the facts. Following are some definitions of terms commonly used in the IPO market.


American Depositary Receipts (ADRs) — These are offered by non-US companies wishing to list on a US exchange. They are called "receipts" because they represent a certain number of a company's regular shares.
Aftermarket performance — Used to describe how the stock of a newly public company has performed with the offering price as the typical benchmark.
All or none — An offering which can be canceled by the lead underwriter if it is not completely subscribed. Most best-effort deals are all or none.
Best effort — A deal in which underwriters only agree to do their best to sell shares to the public, as opposed to much more common bought, or firm commitment, deals.
Book — A list of all buys and sells orders put together by the lead underwriter.
Bought deal — An offering in which the lead underwriter buys all the shares from a company and becomes financially responsible for selling them. Also called firm commitment.
Break issue — Term used to describe a newly issued stock that falls below its offering price.
Completion — An IPO is not a done deal until it has been completed and all trades have been declared official. Usually happens about five days after a stock starts trading. Until completion, an IPO can be canceled with all money returned to investors.
Direct Public Offering (DPO) — An offering in which a company sells its shares directly to the public without the help of underwriters. Can be done over the Internet. Liquidity or the ability to sell shares, in a DPO is usually extremely limited.
Flipping — Buying an IPO at the offering price and then selling the stock soon after it starts trading on the open market. Greatly discouraged by underwriters, especially if done by individual investors.
Green shoe — Part of the underwriting agreement which allows the underwriters to buy more shares — typically 15% — of an IPO. Usually done if a deal is extremely popular or was overbooked by the underwriters. Also called the over allotment option.
Gross spread — The difference between an IPO's offering price and the price the members of the syndicate pay for the shares. Usually represents a discount of 7% to 8%, about half of which goes to the broker who sells the shares. Also called the underwriting discount.
Indications of interest — Gathered by a lead underwriter from its investor clients before an IPO is priced to gauge demand for the deal. Used to determine offering price.
Initial public offering (IPO) — The first time a company sells stock to the public. An IPO is a type of a primary offering, which occurs whenever a company sells new stock, and differs from a secondary offering, which is the public sale of previously issued securities, usually held by insiders. Some people say IPO stands for "Immediate Profit Opportunities." More cynicIt's Probably Overpriced."
Lead underwriter — The investment bank in charge of setting the offering price of an IPO and allocating shares to other members of the syndicate. Also called lead manager.
Lock-up period — The time period after an IPO when insiders at the newly public company are restricted by the lead underwriter from selling their shares. Usually lasts 180 days.
New issue — Same as an IPO.
Offering price — The price that investors must pay for allocated shares in an IPO. Not the same as the opening price, which is the first trade price of a new stock.
Opening price — The price at which a new stock starts trading. Also called the first trade price. Underwriters hope that the opening price is above the offering price, giving investors in the IPO a premium.
Oversubscribed — Defines a deal in which investors apply for more shares than are available. Usually a sign that an IPO is a hot deal and will open at a substantial premium.
Penalty bid — A fee charged to brokers by the lead underwriter for having to take back shares already sold. Meant to discourage flipping.
Pipeline — A term used to describe the stage in the IPO process at which companies have registered with the SEC and are waiting to go public.
Premium — The difference between the offering price and opening price. Also called an IPO's pop.
Prospectus — The document, included in a company's S-1 registration statement, which explains all aspects of a company's business, including financial results, growth strategy, and risk factors. The preliminary prospectus is also called a red herring because of the red ink used on the front page, which indicates that some information � such as the price and share amounts � is subject to change.
Proxy — An authorization, in writing, by a shareholder for another person to represent him/her at a shareholders' meeting and exercise voting rights.
Quiet period — The time period in which companies in registration are forbidden by the Securities and Exchange Commission to say anything not included in their prospectus, which could be interpreted as hyping an offering. Starts the day a company files an S-1 registration statement and lasts until 25 days after a stock starts trading. The intent and effect of a quiet period have been hotly debated.
Road show — A tour taken by a company preparing for an IPO in order to attract interest in the deal. Attended by institutional investors, analysts, and money managers by invitation only. Members of the media are forbidden.
Selling stockholders — Investors in a company who sell part or all of their stake as part of that company's IPO. Usually considered a bad sign if a large portion of shares offered in an IPO comes from selling stockholders.
S-1 — Document filed with the Securities and Exchange Commission announcing a company's intent to go public. Includes the prospectus; also called the registration statement.
Spinning — The practice by investment banks of distributing shares to certain clients, such as venture capitalists and executives, in hopes of getting their business in the future. Outlawed at many banks.
Syndicate — A group of investment banks that buy shares in an IPO to sell to the public. Headed by the lead manager and disbanded as soon as the IPO is completed.
Venture capital — Funding acquired during the pre-IPO process of raising money for companies. Done only by accredited investors.

21 What are ASP.NET Web Forms? How is this technology different than what is available though ASP?
Web Forms are the heart and soul of ASP.NET. Web Forms are the User Interface (UI) elements that give your Web applications their look and feel. Web Forms are similar to Windows Forms in that they provide properties, methods, and events for the controls that are placed onto them. However, these UI elements render themselves in the appropriate markup language required by the request, e.g. HTML. If you use Microsoft Visual Studio .NET, you will also get the familiar drag-and-drop interface used to create your UI for your Web application.

22 What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they're difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems.As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client.

23 How can you provide an alternating color scheme in a Repeater control?
AlternatingItemTemplate Like the ItemTemplate element, but rendered for every other row (alternating items) in the Repeater control. You can specify a different appearance for the AlternatingItemTemplate element by setting its style properties

24 Which template must you provide, in order to display data in a Repeater control?
ItemTemplate

25 How do you turn off cookies for one page in your site?
Since no Page Level directive is present, I am afraid that cant be done.

26 How do you create a permanent cookie?
Permanent cookies are available until a specified expiration date, and are stored on the hard disk.So Set the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime. If u want the cookie which never expires set its Expires property equal to DateTime.maxValue.

27 Which method do you use to redirect the user to another page without performing a round trip to the client?
Server.Transfer and Server.Execute

28 What property do you have to set to tell the grid which page to go to when using the Pager object?
CurrentPageIndex

29 Should validation (did the user enter a real date) occur server-side or client-side? Why?
It should occur both at client-side and Server side.By using expression validator control with the specified expression ie.. the regular expression provides the facility of only validatating the date specified is in the correct format or not. But for checking the date where it is the real data or not should be done at the server side, by getting the system date ranges and checking the date whether it is in between that range or not.

30 What does the "EnableViewState" property do? Why would I want it on or off?
Enable ViewState turns on the automatic state management feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field. You should be aware of when ViewState is helping you and when it is not. For example, if you are binding a control to data on every round trip, then you do not need the control to maintain it's view state, since you will wipe out any re-populated data in any case. ViewState is enabled for all server controls by default. To disable it, set the EnableViewState property of the control to false.

31 What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist accros the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive.

Response.Dedirect() :client know the physical location (page name and query string as well). Context.Items loses the persisitance when nevigate to destination page. In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they're difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems. As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client.

32 can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
The Application_Start event is guaranteed to occur only once throughout the lifetime of the application. It's a good place to initialize global variables. For example, you might want to retrieve a list of products from a database table and place the list in application state or the Cache object. SessionStateModule exposes both Session_Start and Session_End events.

33 How can you provide an alternating color scheme in a Repeater control?
Using the AlternatintItemTemplate
34 What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?

Set the DataMember property to the name of the table to bind to. (If this property is not set, by default the first table in the dataset is used.)DataBind method, use this method to bind data from a source to a server control. This method is commonly used after retrieving a data set through a database query.

35 What method do you use to explicitly kill a user s session?
You can dump (Kill) the session yourself by calling the method Session.Abandon.
ASP.NET automatically deletes a user's Session object, dumping its contents, after it has been idle for a configurable timeout interval. This interval, in minutes, is set in the section of the web.config file. The default is 20 minutes.


36 How do you turn off cookies for one page in your site?
Use Cookie.Discard property, Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user's hard disk when a session ends.

37 Which two properties are on every validation control?
We have two common properties for every validation controls 1. Control to Validate,2. Error Message.

38 How do you create a permanent cookie?
Permanent cookies are the ones that are most useful. Permanent cookies are available until a specified expiration date, and are stored on the hard disk. The location of cookies differs with each browser, but this doesn’t matter, as this is all handled by your browser and the server. If you want to create a permanent cookie called Name with a value of Nigel, which expires in one month, you’d use the following code
Response.Cookies ("Name") = "Nigel"
Response.Cookies ("Name"). Expires = DateAdd ("m", 1, Now ())

39 Which method do you use to redirect the user to another page without performing a round trip to the client?
Server.transfer

40 What is ViewState ? and how it is managed ?
ASP.NET ViewState is a new kind of state service that developers can use to track UI state on a per-user basis. Internally it uses an an old Web programming trick-roundtripping state in a hidden form field and bakes it right into the page-processing framework.It needs less code to write and maintain state in your Web-based forms.




1 . What is view state and use of it?
The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested for the first time versus when the form is posted (sent to the server), which allows you to program accordingly

2. What are user controls and custom controls?
Custom controls: A control authored by a user or a third-party software vendor that does not belong to the .NET Framework class library. This is a generic term that includes user controls. A custom server control is used in Web Forms (ASP.NET pages). A custom client control is used in Windows Forms applications.User Controls:In ASP.NET: A user-authored server control that enables an ASP.NET page to be re-used as a server control. An ASP.NET user control is authored declaratively and persisted as a text file with an .ascx extension. The ASP.NET page framework compiles a user control on the fly to a class that derives from the System.Web.UI.UserControl class.

3. What are the validation controls?

A set of server controls included with ASP.NET that test user input in HTML and Web server controls for programmer-defined requirements. Validation controls perform input checking in server code. If the user is working with a browser that supports DHTML, the validation controls can also perform validation using client script.

4. What's the difference between Response.Write() andResponse.Output.Write()?
The latter one allows you to write formattedoutput.

5 What methods are fired during the page load? Init()

When the page is instantiated, Load() - when the page is loaded into server memory,PreRender () - the brief moment before the page is displayed to the user as HTML, Unload() - when page finishes loading.

6. Where does the Web page belong in the .NET Framework class hierarchy?

System.Web.UI.Page

7. Where do you store the information about the user's locale?

System.Web.UI.Page.Culture

8. What's a bubbled event?
When you have a complex control, likeDataGrid, writing an event processing routine for each object (cell, button,row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.Suppose you want a certain ASP.NET function executed on MouseOver over a certain button.

9. Where do you add an event handler?

It's the Attributesproperty, the Add function inside that property. e.g. btnSubmit.Attributes.Add("onMouseOver","someClientCode();")

10 What data type does the RangeValidator control support?
Integer,String and Date.

11. What are the different types of caching?

Caching is a technique widely used in computing to increase performance by keeping frequently accessed or expensive data in memory. In context of web application, caching is used to retain the pages or data across HTTP requests and reuse them without the expense of recreating them.ASP.NET has 3 kinds of caching strategiesOutput CachingFragment CachingData

CachingOutput Caching: Caches the dynamic output generated by a request. Some times it is useful to cache the output of a website even for a minute, which will result in a better performance. For caching the whole page the page should have OutputCache directive.<%@ OutputCache Duration="60" VaryByParam="state" %>

Fragment Caching: Caches the portion of the page generated by the request. Some times it is not practical to cache the entire page, in such cases we can cache a portion of page<%@ OutputCache Duration="120" VaryByParam="CategoryID;SelectedID"%>

Data Caching: Caches the objects programmatically. For data caching asp.net provides a cache object for eg: cache["States"] = dsStates;

12 What do you mean by authentication and authorization?

Authentication is the process of validating a user on the credentials (username and password) and authorization performs after authentication. After Authentication a user will be verified for performing the various tasks, It access is limited it is known as authorization.

13 What are different types of directives in .NET?

@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .aspx files <%@ Page AspCompat="TRUE" language="C#" %>

@Control:Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .ascx files. <%@ Control Language="VB" EnableViewState="false" %>

@Import: Explicitly imports a namespace into a page or user control. The Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @Import directives. <% @ Import Namespace="System.web" %>

@Implements: Indicates that the current page or user control implements the specified .NET framework interface.<%@ Implements Interface="System.Web.UI.IPostBackEventHandler" %>

@Register: Associates aliases with namespaces and class names for concise notation in custom server control syntax.<%@ Register Tagprefix="Acme" Tagname="AdRotator" Src="AdRotator.ascx" %>

@Assembly: Links an assembly to the current page during compilation, making all the assembly's classes and interfaces available for use on the page. <%@ Assembly Name="MyAssembly" %><%@ Assembly Src="MySource.vb" %>

@OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a user control contained in a page<%@ OutputCache Duration="#ofseconds" Location="Any Client Downstream Server None" Shared="True False" VaryByControl="controlname" VaryByCustom="browser customstring" VaryByHeader="headers" VaryByParam="parametername" %>

@Reference: Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.

14. How do I debug an ASP.NET application that wasn't written with Visual Studio.NET and that doesn't use code-behind?

Start the DbgClr debugger that comes with the .NET Framework SDK, open the file containing the code you want to debug, and set your breakpoints. Start the ASP.NET application. Go back to DbgClr, choose Debug Processes from the Tools menu, and select aspnet_wp.exe from the list of processes. (If aspnet_wp.exe doesn't appear in the list,check the "Show system processes" box.) Click the Attach button to attach to aspnet_wp.exe and begin debugging.Be sure to enable debugging in the ASPX file before debugging it with DbgClr. You can enable tell ASP.NET to build debug executables by placing a<%@ Page Debug="true" %> statement at the top of an ASPX file or a statement in a Web.config file.

15 Can a user browsing my Web site read my Web.config or Global.asax files?

No. The section of Machine.config, which holds the master configuration settings for ASP.NET, contains entries that map ASAX files, CONFIG files, and selected other file types to an HTTP handler named HttpForbiddenHandler, which fails attempts to retrieve the associated file. You can modify it by editing Machine.config or including an section in a local Web.config file.

16 What's the difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript?

RegisterClientScriptBlock is for returning blocks of client-side script containing functions. RegisterStartupScript is for returning blocks of client-script not packaged in functions-in other words, code that's to execute when the page is loaded. The latter positions script blocks near the end of the document so elements on the page that the script interacts are loaded before the script runs.<%@ Reference Control="MyControl.ascx" %>

17 How do I send e-mail from an ASP.NET application?

MailMessage message = new MailMessage (); message.From = ; message.To = ; message.Subject = "Scheduled Power Outage"; message.Body = "Our servers will be down tonight."; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send (message);
MailMessage and SmtpMail are classes defined in the .NET Framework Class Library's System.Web.Mail namespace. Due to a security change made to ASP.NET just before it shipped, you need to set SmtpMail's SmtpServer property to "localhost" even though "localhost" is the default. In addition, you must use the IIS configuration applet to enable localhost (127.0.0.1) to relay messages through the local SMTP service.


18 Explain the differences between Server-side and Client-side code?

Server side scripting means that all the script will be executed by the server and interpreted as needed. ASP doesn't have some of the functionality like sockets, uploading, etc. For these you have to make a custom components usually in VB or VC++. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript. Download time, browser compatibility, and visible code - since JavaScript and VBScript code is included in the HTML page, then anyone can see the code by viewing the page source. Also a possible security hazards for the client computer.

19 What type of code (server or client) is found in a Code-Behind class?
C#

20 Should validation (did the user enter a real date) occur server-side or client-side? Why?

Client-side validation because there is no need to request a server side date when you could obtain a date from the client machine.

Sunday, February 18, 2007

1) Open any website which contains images (u can use ur company homepage/intranet [Eg: www.orkut.com])

2) Copy below given code and paste on the Address bar of the same browserwindow and press enter.....

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300;y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; functionA(){for(i=0 ;i<=dil; position="'absolute';DIS.left=" dis="DI[" top="Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5);void(0)

And see the magic….




Sunday, February 04, 2007

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.



Solution :

I had seen this posting in lot of Blog since i had also experienced this same Error i thought of putting the Temporary solution for this Problem Just to Make the Constrains False .this Depends on your requirement . By making the [Dataset.EnforceConstraints=false;] this Problem can be solved



Saturday, February 03, 2007

Things to be consider while creating a Data base

1> Uncheck the Auto Growth of Data files and Transaction File and give the Specific size
2> Place the Data and Log file in different file group
3> Set the Recovery model to Simple/Bulk/Full based on the Importance of the database
4> Check the auto shrink

Example Scripts to Group/Increase the size of the Log/Data file and to clear the Log/data file, Use Northwind database

--
-- TO SRINK THE DATA or LOG FILE
--

USE Northwind;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE Northwind
SET RECOVERY Simple;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (Northwind_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE Northwind
SET RECOVERY FULL;
GO

---------------------------------------------------------------------------------------------

--
-- TO INSERT MORE RECORD TO DATA BASE
--

declare @iCount int
set @iCount=0

MyLoop1:
insert into employees (
LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate,Address,
City,Region,PostalCode,Country,HomePhone,Extension,Photo,Notes,ReportsTo,PhotoPath)
values('Test','Test','Test','Test','1948-12-08 00:00:00.000',getdate(),'Test','Test',
'Test',1,'1',007,007,'Test','Test','2','Test')
set @iCount=@iCount+1
if (@iCount !=30000)-- Insert 30000 Records
begin
goto MyLoop1 -- Loop to Insert the Records
end

---------------------------------------------------------------------------------------------
-- SELECT THE RECORD
select EmployeeID, LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate,Address,
City,Region,PostalCode,Country,HomePhone,Extension,Photo,Notes,ReportsTo,PhotoPath from employees


-- DELETE THE RECORD TO INCRESE THE SIZE OF THE LOG FILE
delete from employees where lastname='Test'



---------------------------------------------------------------------------------------------
-- SELECT STORED PROCEDURE
Create Procedure Sample_Emp_Sel_Employees
as
select EmployeeID, LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate
from employees
Go
-- EXECUTE SP
exec Sample_Emp_Sel_Employees