Wednesday, 16 September 2020

Deploying MVC in website in Big Rocks getting Security Error

 Once you deploy your website into big rocks you are getting the /Security Error.,


I faced the similar issue like below




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 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 failed.]
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +165
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
   System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +272
   System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, RuntimeAssembly asm, SecurityAction action) +55
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +70
   System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +39
   System.Type.GetType(String typeName) +50
   System.CodeDom.Compiler.CompilerInfo.get_IsCodeDomProviderTypeValid() +10
   System.Web.Compilation.CompilationUtil.GetRecompilationHash(CompilationSection ps) +2090
   System.Web.Configuration.CompilationSection.get_RecompilationHash() +107
   System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDateInternal(Int64 cachedHash) +465
   System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDate(Int64 cachedHash) +51
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +132
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521

--------------------------------------------------

It is happning even you are providing the trust level as full like below.

<system.Web>
...
    <trust level="Full"/>
...
</system.Web>
-----------------------------------------------

And fix for that is

You need to contact the  big rocks supporting team as your site need the  configuration of 4.7 , as it is build in MVC 5.0 + version so just check with them and they will give CAS access to full. Even if you do setting in PLSK it wont work they will provide it to you.


Tuesday, 26 May 2020

Nestjs Error: Cannot find module './app.controller'



Issue :
------------------------------------
internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module './app.controller'
Require stack:
- C:\Users\DELL\Documents\Nestjs-api\app\api\dist\src\app.module.js
- C:\Users\DELL\Documents\Nestjs-api\app\api\dist\src\main.js
------------------------------------
Solution
------------------------------------
open nodejs command
npm run prebuild
------------------------------------

Monday, 25 May 2020

Error : Set the value to `true` or `false` explicitly to silence this message. node_modules\mssql\lib\tedious\connection-pool.js:61:23

Issue :

While creating the NestJS with MSSQl application after creating the ormconfig and take the reference .
Getting the warning message as :
[Nest] 12236   - 05/23/2020, 6:27:56 PM   [NestFactory] Starting Nest application...
tedious deprecated The default value for `config.options.enableArithAbort` will change from `false` to `true` in the next major version of `tedious`.

Solution

In your connection options you should add:
extra: {
  options: {
     enableArithAbort: true // or `false`. Just set it explicitly to silence the warning message
  }
}

Wednesday, 4 September 2019

Default and Named exports in ReactJs



There are two ways you can import your classes it based on how you will do the exports.

import React from 'react'  // Default Export
import {Component} from 'react' // Named Export

Here you can see the import is with bracket and another one is without bracket.

As I told in the first line export are two type:
1. Default Export
2. Named Export

Any of the components can have one default export and can have 0 or more than 1 named export.

Example of Named export as like.
export const Greet = () => <h1> Hello Satya</h1>

Than it will be import to the another component as like
import {Greet} from './myComponentes/Greets' // named export

import {Greet as SomeName} from './myComponentes/Greets';

If you will see the above Greet is in side of curly bracket.

Example of default export
Exporting a function values like below.
function Greet()
{
    return <h1> Hello Satya</h1>
}

//export const Greet = () => <h1> Hello Satya</h1>

export default Greet;

Now you can import it to the other component as like
import Greet from './myComponentes/Greets'


Monday, 4 March 2019

selenium basics for beginners


 Selenium Introduction

 l  Selenium is an open source tool (no cost involved – free to download from Seleniumhq) “https://docs.seleniumhq.org/download/”
l  Selenium supports language like HTML, Java, PHP, purl, Python, Ruby and C# .
l  Selenium supports multiple web browsers like, IE, Firefox, Chrome, Opera
l  Selenium supports multiple Operating systems like Windows, Linux, Mac
l  Selenium Components


Saturday, 9 February 2019

Call python code in C# using IronPython


Why it’s required?

Python has lots of  useful library that we can utilise in our application and get that functionality in our webapplication. So just trying how to get the python features in MVC applications.

Using the Ironpython  to call the python code in C# code.  Follow the steps and use the below code to call the python code.

1.       Taking the reference of IronPython  using the Nuget Package as like below.


Print value of textarea using javascript



We are facing the problem to print the full textarea text when using the default browser print. It will print the full content of the pages which will print only that text which is visible to the textarea.


Content which is not displaying or go out of page due to overflow. Please use below code to see that.

We are having the Textarea and div control and when we click on the print then it will hide the text area and put the Textarea text to div