Sunday, February 28, 2010

Web Page

------------------------------
Securing Your Config files
---------------------------

Two Ways

1. Using Command prompt with Commands
2. Using Enterprise Library


1. Using Command prompt with Commands

1. Go to Command Prompt

2. Change Directory to C:\Windows\Microsoft.NET\Framework\v2.0.50727

3. To Encrypt a Section in Web.Cofig - type following -

aspnet_regiis -pef ""

i.e. aspnet_regiis -pef "connectionStrings" “C:\Inetpub\wwwroot\TestWebSite"

i.e. aspnet_regiis -pef "system.web/identity" “C:\Inetpub\wwwroot\TestWebSite"

4. Go to your website root directory, and create a File AppUser.Aspx and type the following line save it.

a. < %@ Page Language="VB" % >

< % Response.Write( System.Security.Principal.WindowsIdentity.GetCurrent().Name ) % >

b. Now, open your browser and call this page, this will show you a DOMAIN/UserName under which you website is running. Take a note of it. Now go back to command prompt.

5. Run the following command on command prompt to allow Permission to Users e.g. "NT Authority\Network Service", and the User Your Web Site is using it. run following command

aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT Authority\Network Service"

aspnet_regiis -pa "NetFrameworkConfigurationKey" "DOMAIN/USERNAME"

6. After successful completion of command, remove the AppUser.Aspx file.

7. If you ever want to decrypt the section you encrypted, use following command

aspnet_regiis -pdf "CONFIG_SECTION" "PHYSICAL_PATH"

You do not need to make any code change in your application for encryption or decryption, .NET automatically does it for you.

For more details you can visit http://msdn.microsoft.com/en-us/library/ms998283.aspx

File: App.Config using Command Prompt

So what would you do to encrypt the same in case of App.Config, above command only work for Web.Config. Here is a trick – Copy the contents of App.Config into Web.Config file, or you can rename as web.config. Follow the same instructions as above, and after encryption, copy the file contents or rename it back to App.Config.


2. Using Enterprise Library

If you have downloaded and Installed Microsoft Enterprise Library Configuration Tool, just open Web.Config or App.Config and select the section you want to encrypt, Go into Protection à Protection Provider and choose a provider you want (default is none) and save the file, you are done. BUT, you may have to follow #4 - #6, if .NET is not able to read encrypted section.


----------------------------------------------------
Data Transform from Master Page to Content Page
----------------------------------------------------
1. By Using Property.
2. By Using Session.


1. By Using Property

In Master Page :-

public string CatFilter
{
get { return DropDownList1.SelectedValue.ToString(); }
}


In content Page :-

protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = ((MasterTest)Page.Master).CatFilter;

}


2. By Using Session.


In Master Page :-

Session["name"] = DropDownList1.SelectedValue.ToString();


In content Page :-

if(Convert.ToString(Session["name"]) != string.Empty)
Label1.Text = Session["name"].ToString();




----------------------------------------------
Common Validation Messages in web pages
----------------------------------------------
1. Record already exists.
2. Record updated successfully.
3. Mass updation is not allowed.
4. 'No row has been selected for edit! Please select a row'.
5. Deletion failed for the referenced Item(s).
6. Click the /'New/' icon to add new items.
7. Record saved successfully.
8. Are you sure, you want to delete?.
9. Please select an item to delete.
10. On multirow selecte and click on edit: Mass updation is not allowed.
11. The record Already exist.
12. Please Select a record before Updating.
13. Please Enter the value ---.
14. Record Should not be Empty.
15. Sorry, You are not Authoried User.
16. Please Select .....
17. Admin Confirmation Required.
18. Please Contact Your System Admin.


---------------------------
Web Page code check list
---------------------------

1. Is the Webpage marked with an appropriate namespace ?

2. Does the Webpage title map to ------ ?

3. Does all the controls name/Id follow naming conventions ?

4. Is all the client side script placed in a separate script file ?

5. Is the Webpage code properly indented ?

6. Does all the static text driven from label control ?

7. Is the maxlength specified as per the DB specifications for all the

input controls ?

8. Are all the Style definitions derived from the Theme ?

9. Are all the actions in the webpage implemented via aspButton control ?

10. Are all the alert messages implemented using javascript (or radAlert) ?

11. Are all the alert messages to the User driven from the resource file ?

12. Is the Webpage globalized/localized ?

13. Is the Webpage code properly grouped to respective content placeholders ?

14. Have all the unused variables been removed ?

15. Have all the unused Usings been removed ?

16. Have all the variables been checked for loss of data during conversion ?

17. Does the Switch Statement contain a default case ?

18. Have all the debugging statements (using alert and Response. Write) been

removed ?

19. Does all the variables, methods and Classes follow naming conventions ?

20. Is the Program Header complete and meaningful ?

21. Is every object checked for null before usage ?

22. Is data grouped together for efficient processing ?

23. Is necessary data getting inserted in the DB properly ?

24. Is user input being thoroughly validated before being processed?

25. Does the screen work with “no” data? (if no records are in the Database)

26. Has any repetitive code been organized into a separate function?

27. Are the necessary conditions being checked before looping?

28. Have all the class member variable names been started with m_?

29. Is the code properly indented as per the standards ?

30. Have all the static text been driven from the usage of constants?

31. Does all the variables, methods and Classes have appropriate access

specifiers?

32. Is the exception Handling implemented?

33. Have all the Service references been closed ?

34. Is the code logically grouped using namespace ?

35. Is the code physically grouped using region block ?

36. Is the Strict layering followed for all communications within the

application ?

37. Is the data passing mechanism strictly through c# custom class

objects(BDto) only ?

38. Are all the constants defined in their respective constant files ?

39. Is Theme set at Page Pre-Initialization event ?

40. Is Page UI culture set at Page Pre-Initialization event ?

41. Does the classes implement IDisposable wherever applicable ?


------------------------------
HTML Design Test for Table
------------------------------
border="1" cellpadding="0" cellpadding="0"

No comments:

Post a Comment