Friday, 5 April 2013

Dot Net Framework 3.5 Not Installing on Windows 8? Fix it Now!





You may face a common problem while using Windows 8. Microsoft .Net Framework 3.5 is not installed with Windows 8. And several programs may ask you install this. And you can't install this from your PC. It will ask you to connect to the net and use Windows Update. 

By default Windows 8 comes with .Net Framework 4.5 and it doesn't include 3.5. When you try to install .Net 3.5 that you previously downloaded from web the you will see the following message. 




And you will get the same message while installing some some programs that is developed using .Net 3.5 platform. And you will not able to run those programs on your PC! This is a very bad job by Microsoft. A great trouble for Windows 8 users. 

But today you will get the solution. You've install this using command line. I mean you have to use Command Prompt. And surprisingly you Windows 8 DVD includes the .Net Framework 3.5! 

Method 1 (Offline Installation using cmd):
  1. Enter your Windows 8 Installation Disk on DVD Drive.
  2. Now run Command Prompt as Administrator. (Hint: Start > Type cmd > Now right click on Command Prompt and hit on Run as Administrator from the bottom)
  3. Now copy the following command and paste it in the command prompt window. Or type the following line in command prompt. Press Enter (To paste the command in command prompt, click the right button of mouse and select paste)
  4. Now .Net Framework will be installed within few minutes. 
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:h:\sources\sxs


Remember: h is the drive letter of DVD drive. Change it with your DVD drive letter. 


Method 2 (Online Method using Windows Update): 

If you follow all the instructions of method 1 you will be able to install .net 3.5 properly. But if there is any problem for example- you don't have DVD drive, or your Windows DVD doesn't contain it then you can install it directly from Windows Update option. More or less you've to download 200 MB data from internet. 

Follow the instruction below: 
Control Panel > Programs and Features > Turn Windows Features on or off > Mark the option .NET Framework 3.5 (includes .NET 2.0 and 3.0) > OK. 
Now you will see a window like the image above. Hit on Install This Feature. And make sure you're connected to the net. That's it.  


Installing a Windows language pack on Windows 8 before installing the .NET Framework 3.5 will cause the .NET Framework 3.5 installation to fail. Install the .NET Framework 3.5 before installing any Windows language packs.

Monday, 1 April 2013

System.Security.SecurityException: Request for the permission of type ‘System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.


Server Error in ‘/’ Application.


Security Exception

Description:

The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.

Source Error:An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:
[SecurityException: Request for the permission of type
'System.Web.AspNetHostingPermission, System,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.]
   System.Reflection.Assembly._GetType(String name,
Boolean throwOnError, Boolean ignoreCase) +0
   System.Web.UI.Util.GetTypeFromAssemblies(ICollection
assemblies, String typeName, Boolean ignoreCase) +201
   System.Web.UI.TemplateParser.GetType(String typeName,
Boolean ignoreCase, Boolean throwOnError) +323
   System.Web.UI.TemplateParser.ProcessInheritsAttribute(String
baseTypeName, String codeFileBaseTypeName,
String src, Assembly assembly) +10891548
   System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes
(IDictionary parseData) +365
Cause
The files were downloaded from the internet or an untrusted source.  Your computer/server are blocking them to help in protecting your computer.
Solution:


Right click on each file that you download and choose properties and Unblock.

image
Add the following to the system.web section of the web.config file.
Validate you have the correct .NET code base. You may have 4.0 code that is running as 2.0