How do I support browsing for a text file and reading it into a TextBox?
You can use the OpenFile Dialog to implement this functionality. [C#] using System.Text; using System.IO; private void button1_Click( object sender, EventArgs e ) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = ‘Open text file’ ; dlg.InitialDirectory = @’c:\’ ; dlg.Filter = ‘txt files (*.txt)|*.txt|All files (*.*)|*.*’ ; if ( dlg.ShowDialog() == DialogResult.OK ) { StreamReader sr = File.OpenText( dlg.FileName ); string s = sr.ReadLine(); StringBuilder sb = new StringBuilder(); while ( s != null ) { sb.Append(s); s = sr.ReadLine(); } sr.Close(); textBox1.Text = sb.ToString(); } }
What is an Atlas?
Atlas is interesting concept extended form AJAX, integrated in ASP.NET 2.0. It extends the concept of AJAX in 2 different ways. 1.It provides the clide side scripting libraries that enable the developers to create the interactive Uis and allows the remote procedure calls by providing the true OO API’s and Components. 2.It provides the rich integrate server development in ASP.NET 2.0. For further information visit this link.
How to control viewstate on individual controls
You can set the EnableViewState property of the control. You should disable viewstate for any control that doesn’t use it to guarantee optimum performance.
How to close the browser window on button control click
Method 1. This will cause a postback on button click in response to which we will send some script to close the window. VB.NET Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Response.Write(‘<script>window.close();</script>’) End Sub C# private void Button1_Click(object sender, System.EventArgs e) { Response.Write(‘<script>window.close();</script>’); } Method 2. This is preferable since there is no postback involved. Use the Attribute collections i.e use Attributes of button control to add client side JavaScript code VB.NET Button1.Attributes.Add(‘OnClick’, ‘window.close();’) C# Button1.Attributes.Add(‘OnClick’, ‘window.close();’);
What is the difference between authentication and authorization
Authentication is the process of identifying and verifying who the client accessing the server is. For example, if you use Windows authentication and are browsing an ASP.NET page from server — ASP.NET/IIS would automatically use NTLM to authenticate you as SYNCFUSION\user1 (for example). Forms based authentication, then you would use an html based forms page to enter username/password — which would then check a database and authenticate you against the username/password in the database. Authorization is the process of determining whether an authenticated user has access to run a particular page within an ASP.NET web application. Specifically, as an application author decide to grant or deny the authenticated user ‘SYNCFUSION\user1’ access to the admin.aspx page. This could be done either by explicitly granting/denying rights based on the username — or use role based mappings to map authenticated users into roles (for example: an administrator might map ‘SYNCFUSION\user1’ into the ‘Power Users’ role) and then grant/deny access based on role names (allowing a degree of abstraction to separate out your authorization policy).