יום שלישי, 10 בפברואר 2009

מהי הרשאת internal?

בדומה להרשאות גישה של public/private קיימת הרשאה בשם internal. הראשת internal קובעת כי המשאב הזה יהיה זמין רק בתוך ה-assembly שבה נכתבה המחלקה. למשל, אם יצרנו שכבה אחת במערכת שרצינו להגביל לה גישה למתודה\מחלקה\Property מסויימת לשימוש פנימי בתוך אותה assembly נשתמש בהרשאת הגישה internal.

מה קורה כאשר שרת ה IIS מקבל בקשה חדשה


1. מגיע בקשה לקבלת דף אינטרנט מהשרת מדפדפן הלקוח.

2. ה IIS ממפה את הסיומת של הקובץ אותו הלקוח ביקש (1.aspx)  אל ה ASPNET_ISAPI.DLL  שרות המספוק על ידי ה asp.net

3. ה ASPNET_ISAPI.DLL מעביר את הבקשה לתהליך של ה ASP.NET  - מופיע כ (ASPNET_WP.EXE or W3P.EXE).

4. המשך יבוא......

ASP.NET IIS Registration Tool.

How to and when to use ASP.NET IIS Registration Tool. 

If .NET framework is installed before IIS then we get this problem "Server application unavailable" when we run any application on IIS.
 
For this we need to register ASP.NET with IIS.
 
Go to command promt and go to .NET directory (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727).
Then run this command aspnet_regiis -i for registering ASP.NET runtime with IIS. and aspnet_regiis -c for installing client side scripts.
 
The tool can also be used to determine which version of the common language runtime (CLR) is used for the application and also to display the status of all installed versions of ASP. NET, register the ASP.NET version that is coupled with the tool, create client-script directories, and perform other configuration operations.
 
Below are the options that we get with this tool.
 
Option Description 
-c
 Installs the client-side scripts for ASP.NET, such as client-side validation scripts, to the aspnet_client subdirectory of each Internet Information Services (IIS) site directory.

Only the client-side scripts for the ASP.NET version that is associated with Aspnet_regiis.exe are installed.
 
-disable
 Disables ASP.NET in the IIS Security Console.

This option can be combined only with the -i, -ir, or -r options. It is not available with IIS versions earlier than IIS 6.0.
 
-e
 Removes the client-side scripts for ASP.NET from the aspnet_client subdirectory of each IIS site directory.

Only the client-side scripts for the ASP.NET version associated with Aspnet_regiis.exe are removed.
 
-ea
 Removes the client-side scripts for all versions of ASP.NET from the aspnet_client subdirectory of each IIS site directory.
 
-enable
 Enables ASP.NET in the IIS Security Console.

This option can be combined only with the -i, -ir, or -r options. It is not available with IIS versions earlier than IIS 6.0 or with ASP.NET versions earlier than ASP.NET version 2.0.
 
-ga user
 Grants the specified user or group access to the IIS metabase and other directories that are used by ASP.NET.

This option is not available with ASP.NET versions earlier than ASP.NET 2.0.
 
-i
 Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and updates the script maps at the IIS metabase root and below.

Only the script maps for applications that use an earlier version of ASP.NET are updated. Applications that use a later version are not affected.
 
-ir
 Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and only registers ASP.NET in IIS.

This option does not update the script maps. To install ASP.NET and update the script maps, use the -i option.
 
-k path
 Removes the script maps to all versions of ASP.NET from all ASP.NET applications at the specified application root path and its subdirectories.
 
-kn path
 Removes the script maps to all versions of ASP.NET from the ASP.NET application only at the specified application root path.

This option does not affect applications in subdirectories of the specified path.
 
-lk
 Lists the path and version of all IIS metabase keys where ASP.NET is mapped.

The keys that inherit ASP.NET script maps from a parent key are not displayed.
 
-lv
 Lists the status and installation path of all versions of ASP.NET that are installed on the computer.
 
-norestart
 Inhibits the restart of the World Wide Web Publishing Service after installing or updating ASP.NET script maps. If you do not use this option, all application pools are recycled.

Use this option with the -i or -r options when the IIS worker process will be restarted manually.
 
-r
 Updates all of the script maps in the IIS metabase and below to point to the ASP.NET ISAPI version that is associated with Aspnet_regiis.exe.

All existing script maps are updated to point to the ASP.NET ISAPI version that is associated with the ASP.NET IIS Registration tool, regardless of the current version.
 
-s path
 Installs the script map that points to the ASP.NET ISAPI version associated with Aspnet_regiis.exe to all ASP.NET applications at the specified application root path and its subdirectories. All existing script maps in the specified path and below that use an earlier version of the ASP.NET ISAPI are updated.
 
-sn path
 Installs the script map that points to the ASP.NET ISAPI version associated with the tool to the ASP.NET application at the specified application root path. All existing script maps in the specified path that use an earlier version of the ASP.NET ISAPI are updated.

This option does not affect applications in subdirectories of path.
 
-u
 Uninstalls the version of ASP.NET that is associated with the ASP.NET IIS Registration tool from the computer. Existing script maps to this version of the ASP.NET ISAPI are automatically remapped to the most recent remaining ASP.NET ISAPI version installed.
 
-ua
 Uninstalls all versions of ASP.NET from the computer.
 
-?
 Displays the command syntax and options for the ASP.NET IIS Registration tool.
 

Configuration Options
Option Description 
-config+
 Enables remote access to ASP.NET configuration on the computer.
 
-config-
 Disables remote access to ASP.NET configuration on the computer.
 
-pa container account
 Grants permission for the specified user or group account to access the specified key container. This argument takes the following optional modifiers:

-pku Substitutes a user-specified container for the default machine container.

-csp provider Specifies the container provider to use.

-full Specifies that full access should be added, rather than the default read-only access.
 
-pc container
 Creates an RSA public/private key pair in the specified container. This argument takes the following optional modifiers:

-size keySize Specifies the key size. The default is 1024 bytes.

-pku Substitutes a user-specified container for the default key container on the computer.

-exp Specifies that private keys must be able to be exported.

-csp provider Specifies the container provider to use.
 
-pd section
 Decrypts the configuration section. This argument takes the following optional parameters:

-app virtualPath Specifies that decryption should occur at the level of the included path.

-location subPath Specifies the subdirectory to decrypt.

-pkm Specifies that the Machine.config file should be decrypted instead of the Web.config file.
 
-pdf section webApplicationDirectory
 Decrypts the specified configuration section of the Web.config file in the specified physical (not virtual) directory.
 
-pe section
 Encrypts the specified configuration section. This argument takes the following optional modifiers:

-prov provider Specifies the encryption provider to use.

-app virtualPath Specifies that encryption should occur at the level of the included path.

-location subPath Specifies the subdirectory to encrypt.

-pkm Specifies that the Machine.config file should be encrypted instead of the Web.config file.
 
-pef section webApplicationDirectory
 Encrypts the specified configuration section of the Web.config file in the specified physical (not virtual) directory.
 
-pi container file
 Imports an RSA public/private key pair to the specified container from the specified XML file. This argument takes the following optional modifiers:

-pku Substitutes a user-specified container for the default machine container.

-exp Specifies that private keys can be exported.

-csp provider Specifies the container provider to use.
 
-pr container account
 Removes permission for the specified user or group account to access the specified key container. This argument takes the following optional modifiers:

-pku Substitutes a user-specified container for the default machine container.

-csp provider Specifies the container provider to use.
 
-px container file
 Exports an RSA public/private key pair from the specified container to the specified XML file. This argument takes the following optional modifiers:

-pku Substitutes a user-specified container for the default machine container.

-csp provider Specifies the container provider to use.
 
-pz container
 Deletes the specified key container. This argument takes the following optional modifier:

-pku Substitutes a user-specified container for the default machine container.
 


מה ההבדל בין Dataset.clone and Dataset.copy

clone:
מעתיק רק מבנה ולא מעתיק מידע
 copy:
מעתיק גם מבנה וגם DATA


יום רביעי, 18 ביוני 2008

שאלות לדוגמא מתוך ראיונות עבודה מקצועיים ASP.NET

1. מה ההבדל בין interface ל abstract?




2. מה הם השלבים העקרים בזמן טעית דף ASPX ובאיזה שלה ה CONTROLS נטענו במלואם?
· Page Init
· Page Load
· Control Events
· Page unload events
בשלב ה Page Load מובטח שכל ה controls נטענו , ניתן לגשת אליהם גם בשלב
ה page init אך בשלב זה ה view state עדיין לא נטען במלואו.




3. מה הפקודה של IsPostBack?פקודה זה תחזיר true במקרה שהדף הגיע לשרת מהלקוח וזהו לא הפעם הראשונה בו השרת ניגש לדף זה.



4. כיצד ניתן לוודא שאף אחד לא התעסק עם ה viewState?
על ידי שימוש בהגדרות העמוד (page directives) בשם EnableViewStateMac ל TRUE



5. מה ההבדל בין server.tranfer ל response.redirect?





  • זו שאלה שרוב המראינים אוהבים לשאול השאלה מראה אם יצא לנו לגעת בקוד ולמראין קל לשאול אותה כי היא די טרויאלית למי שנאלץ לעמוד על ההבדלים:


  • רידירקט - השרת בעצם שולח לדפדפן הלקוח הודעה שיש לעבוד לדף אחר ולאחן מכן הלקוח פונה לאותו דף.


  • טרנספר - מעבר בין העמודים נעשה ברמת השרת ועל כן חוסך לנו טיול של שרת-לקוח.


  • טרנספר - איננו משנה את תוכן ה URL דבר שיש לקחת בחשבון כאשר בקוד יש התיחסות לכתובת ה URL ש אותו עמוד.


  • טרנספר - לא ניתן לנוע בין דומינים - לא ניתן לעבור בין http://www.google.com/ ל http://www.walla.co.il/


  • עדיף להשתמש כאשר ניתן ב טרנספר (שיקולי ביצועים ואבטחה).

6. מה זה DATASET?



  • אוביקט השייך למרחב השמות system.data, משמש כתמונה של בסיס נתונים הנשמרת בזכרון האפליקציה, מספק תמיכה במספר נושאי בסיס נתונים כגון עדכון, הוספה, מחיקה, view.
    אוביקט זה מכיל מספר קולקשנים:
    dataTable אחד או יותר.
    בכל dataTable ישנם אחד או יותר dataRow
    בכל DataRow ישנם אחד או יותר DataColum
    בכל DataSet ישנם אחד או יותר DataViews.

    ה DateSet יכול לקבל נתונים מבסיס נתונים או מקובץ XML.


7. CLR?



  • Common Language RunTime - מהווה את הלב של ה NET Framwork. ה CLR אחראי על הפעילויות הבאות:
    1. GC - Garbage Colection , ניהול זכרון תוך כדי טיפול בחריגות זיכרון וניקוי של זכרון מתוך המערכת , כאשר לאוביקטים אין יחוס מאוביקטים אחרים ה GC (דרך לוגיקה של 3 דורות) מנקה את האויבקט מהזכרון וכך יוצר ניהול זכרון יעיל.
    2. CAS - Code Access Security - נותן הרשאות לאפליקציה בהתאם להגדרות של המכונה(שרת).
    3. Code Verification - גורם לביצוע נכון של הקוד ושומר על אחידות בסוג המשתנים בזמן ריצה, מונע מהקוד לבצע פעולות לא חוקיות כגון גישה למקומות בזכרון שאינם קימים.
    4. IL - Intermediate language : ה CLR משתמש ב JIT ומקמפל את ה IL לקוד מכונה (אסמבלי) ואז מבצע.

8. מה זה reflection?



  • שאלה שאוהבים לשאול בראיונות.

  • לכל האסמבלים ב NET. יש מידע בצורה של metadata על כל המתשתנים והפרוצדורות באסמבלי.

  • המידע שקיים בתוך ה metadata יכול להיות נגיש באמצעות מנגנון הנקרא reflection.

  • בעזרת ה reflection ניתן לבצע מתודות באופן דינאמי לא ידיעה מראש על הסוג על ידי שימוש בפונקציה system.type.invokemember

9. ADO.NET


ראיון העבודה של שי - טיפים לראיון עבודה מוצלח

בחלק זה אני אפרסם טיפים לראיון עבודה מוצלח.

  • ראיון עבודה איננו דבר של מה בכך, יש להגיע מוכנים הן ברמה האישית והן ברמה המקצועית בכדי לעבור ראיון עבודה.
  1. שיחת הטלפון הראשונה.
    שיחת הטלפון הראשונה יכולה להיות קצרה שבה רק מזמנים אותך לראיון או ארוכה בה מתשאלים אותך על הקורות חיים שלך ומספרים על החברה בה אתה מתועד להתראיין.
    טיפים לשיחת הטלפון הראשונה:
    1. הכר את קורות חייך אל תהיה מופתע מנתונים המופעים בקובץ קורות החיים שלך.
    2. הכן מראש בראש מעבר קצר ומקצועי של 4-7 דקות על עיקרי הקורות חיים שלך תוך שימת דגש על פרטים כגון תקופת זמן, מקום עבודה, תפקיד, טכנולוגיות (ב 2006 התחלתי לעבוד בחברת nice בתור איש פיתוח בפרויקט אשבל עבדנו בעיקר בטנולוגיות asp.net 2.0 , HTML, css, oracle).
    3. שאל בתחילת השיחה מה תפקידו של מי שמדבר איתך - אם זה מישהו מקצועי הוא כנראה יבין את מה שאתה אומר ולכן הזהר מלומר דברים לא נכונים.
    4. בזמן תאום הראיון חשוב לשאול את הדברים הבאים כתובת, טלפון לבירורים, האם יש חנייה , מי מראין אותך, מה תפקידו, כמה זמן הראיון אמור לקחת, איזה סוג ראיון זה הולך להיות(אישי, מבחן טכני פרונטלי/בכתב/מול מחשב) על מה הולך להיות המבחן (כך תוכל לבצע חזרה על נושא כזה או אחר)
  2. תאום צפיות שכר.
    השאלה של "מה דרישות השכר שלך" תמיד תעלה ובדרך כלל תעלה מהר. מספר נקודות שיש לקחת בחשבון
    1. תמיד יש לדרוש יותר מהסכום הרצוי ב 2000 עד 4000 שקלים.
    2. אם רוצים רכב יש להגיד - עדיף להגיד דרישה בסגנון "24 + רכב" יש לכך משמעות כלכלית שונה מאשר "27 כולל רכב".
    3. יש להגיד "הדרישה שלי 24 + רכב + תנאים" ששואלים תנאים כדאי להגיד כמה שיותר דברים: ביטוח מנהלים, קרן השתלמות, הוצאות רכב(דלק,חניות,ניקוי), הוצאות אוכל, הוצאות טלפון/טלפון חברה.

    כל אחד מהסעיפים האלו שווה הרבה כסף ויש לקחת זאת בחשבון. צריך גם להכיר את הטריק שחברות אוהבות עשות שאומר - 80 אחוז מהשכר מופרש לסוציאלי ועוד 20 אחוז מוגדר כשעות נוספות - יש לזה משמעות כספית וצריך לחשב את זה בשקלול של הצעת השכר.
  3. טיפים טובים לראיון - סוגים של שאלות שניתן לשאול..
    החלק הכי חשוב הראיון עבודה זה הראיון המקצועי, ברוב החברות מתבצע הראיון המקועי כראיון פרונטלי של ראש צוות/איש פיתוח בכיר ששואל שאלות טכניות.
    סוגי שאלות טכניות שמראינים בד"כ שואלים:
    1. שאלות טכניות שבדרך כלל מוקראות מהמחשב או מדף נייר השאלות הן טכניות וחוזורת על עצמן (מה זה dataset ומה ההבדל בינו לבין datareader.
    2. שאלות ניבנות - בהם אתה מתאר מערכת שלקחת בה חלק ואתה נשאל עליה, שאלות אלו בד"כ מראים על עניין שיש למראין בראיון הם גם מראים על עומק כלשהו בראיון שהמראיין מנסה להתאים את השאלות שלו למה שאתה עשית ולא להיפך. במקרה כזה עליך להכיר מערכת מסוימת שכתבת (המראיין לא ממש מכיר את המערכת ולכן ניתן קצת להמציא דברים אבל להיזהר לא להגזים) יש לתאר אותה בקצרה לפי המבנה הבא - טכנולוגיות (c# and sql-server) מבנה ארכיטקטוני (שיטת השכבות, צורת עבודה מול בסיס נתונים...), איזה חלק היה לך במערכת (שים לב שעל הנושא הזה סביר מאוד שתשאל).
    במהלך ראיון כזה סביר שתשאל על דברים שאתה מסביר, לדוגמא אם אתה אומר שעבדת עם ado.net שביר שתשאל על הנושא הזה.
  4. טיפים טובים לראיון - איך לענות לשאלות מקצועיות.
    הדבר הכי חשוב בתשובה לשאולת מקצועיות זה טונציה (טון דיבור נכון). מספר נקודות שכדאי לזכור:
    - שמירה על טון דיבור קבוע ואסרטיבי, לא להתנצל בתשובות, המראיין שמולך בטוח לי יודע את כל הדברים.
    - לא לקפוץ ולענות על שאלות, לגלגל אותם מעט בראש, לחזור על שאלת המראיין בכדי להרוויח עוד מספר שניות של מחשב לסדר את התשובה בראש ואז לענות.
    -לא לענות תוך כדי תנועה - אלא רק לאחר שאתה סגור על התשובה אותה אתהרוצה לתת, במקרה של תשובה תוך כדי תנועה המראיין עלול לקבל רושם שאתה מורח אותו ואז כאשר כבר תגיע לחלק הנכון במשפט זה לא ישמע אמין ותאבד נקודות זכות.