|
1. How do I send e-mail from an ASP.NET application? MailMessage message = new MailMessage (); message.From = <email>; message.To = <email>; 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. 2. How do you register JavaScript for webcontrols ? You can register javascript for controls using <CONTROL -name>Attribtues.Add(scriptname,scripttext) method. 3. When do you set "<IDENTITY impersonate="true" />" ? Identity is a webconfig declaration under System.web, which helps to control the application Identity of the web applicaton. Which can be at any level(Machine,Site,application,subdirectory,or page), attribute impersonate with "true" as value specifies that client impersonation is used. 4. What is the transport protocol you use to call a Web service SOAP ? HTTP Protocol 5. What is the sequence of operation takes place when a page is loaded? - BeginTranaction - only if the request is transacted
- Init - every time a page is processed
- LoadViewState - Only on postback
- ProcessPostData1 - Only on postback
- Load - every time
- ProcessData2 - Only on Postback
- RaiseChangedEvent - Only on Postback
- RaisePostBackEvent - Only on Postback
- PreRender - everytime
- BuildTraceTree - only if tracing is enabled
- SaveViewState - every time
- Render - Everytime
- End Transaction - only if the request is transacted
- Trace.EndRequest - only when tracing is enabled
- UnloadRecursive - Every request
6. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box? DataTextField and DataValueField 7. 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 ()) 8. Difference between asp and asp.net? "ASP (Active Server Pages) and ASP.NET are both server side technologies for building web sites and web applications, ASP.NET is Managed compiled code - asp is interpreted. and ASP.net is fully Object oriented. ASP.NET has been entirely re-architected to provide a highly productive programming experience based on the .NET Framework, and a robust infrastructure for building reliable and scalable web applications." 9. What are the various ways of securing a web site that could prevent from hacking etc .. ? 1) Authentication/Authorization 2) Encryption/Decryption 3) Maintaining web servers outside the corporate firewall. etc., 10. What is web.config file ? Web.config file is the configuration file for the Asp.net web application. There is one web.config file for one asp.net application which configures the particular application. Web.config file is written in XML with specific tags having specific meanings.It includes databa which includes connections,Session States,Error Handling,Security etc. For example : < configuration > < appSettings > < add key="ConnectionString" value="server=localhost;uid=sa;pwd=;database=MyDB" / > < /appSettings > < /configuration >
|