Code Bug Fix: How to use shared project which is in Bit-bucket?

Original Source Link

i have three repositories in bit-bucket( all three are .net-core)
1.web
2.core
3.wed.admin

all three have common project which is in another repository(common infrastructure)
so how can i import that common project in Docker file to compile the code.

thanks

Tagged : / / /

Code Bug Fix: Controller cannot reach Controller in other project because of constructor ASP:NET Core

Original Source Link

I’m new to ASP.NET Core and I’m trying to solve this problem for a week now.
I have a solution with two projects.
And when I start the porject the browser just says:
InvalidOperationException: Unable to resolve service for type ‘TSM_Programm.Data.TSMContext’ while attempting to activate ‘TSM_Programm.Controllers.ResourcesController’.

The first part of the solution is my API-Layer that passes data to a user (currently via postman).
The second project is my Data Access Layer.
This Layer contains several Controllers, all of them using the same constructor, which is the following:

public TSMContext _context;

        public ResourcesController(TSMContext context)
        {
            _context = context;
        }

The TSMContext Class is the following:

namespace TSM_Programm.Data
{
    public class TSMContext : DbContext
    {

        public TSMContext(DbContextOptions<TSMContext> options)
            : base(options)
        {
        }


        public DbSet<Resource> Resources { get; set; }     
        public DbSet<Parameter> Parameters { get; set; }
        public DbSet<ResourceToParameter> ResourceToParameters { get; set; }

        public DbSet<Reservation> Reservations { get; set; }
    }

So far so god, but when I am trying to start the program the controllerof the API-Layer does not seem to be able to handle the constructor.

This is my API-Conrtoller:

namespace TSM_API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class APIController : ControllerBase  //Base Class without View Support
    {


        //Troublemaker
        public ResourcesController _resources;
        public ParametersController _parameters;
        public ReservationsController _reservations;


        public APIController(ResourcesController resources, ParametersController parameters, ReservationsController reservations)
        {
            _resources = resources;
            _parameters = parameters;
            _reservations = reservations;
        }
        //Function to check if controller works
        //GET: api/API
        [HttpGet]
        public IEnumerable<string> Get()
        {
           // ResourcesController controller = new ResourcesController();
            return new string[] { "value1", "value2" };
        }

The API-Controller was not able to use its own constructors, that’s why I changed the Startup.cs.

namespace TSM_API
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            services.AddMvc().AddApplicationPart(typeof(ResourcesController).Assembly).AddControllersAsServices();
            services.AddMvc().AddApplicationPart(typeof(ParametersController).Assembly).AddControllersAsServices();
            services.AddMvc().AddApplicationPart(typeof(ReservationsController).Assembly).AddControllersAsServices();
            services.AddMvc().AddApplicationPart(typeof(TSMContext).Assembly).AddControllersAsServices();


        }

I’m simply out of ideas on how to solve the problem, since I can’t add the TSMContext class a service.
Any idea how to solve it?

Thank you.

I see you have not registered your dbcontext as a dependency injection. Your issue might be due to ResourceController trying to access _context as a DI but it is not registered. To use the context as a dependency injection, register it in the startup.cs as following.

public void ConfigureServices(IServiceCollection services)
{
    services.AddDbContext<TSMContext>(options => options.UseSqlServer(Configuration.GetConnectionString("YOUR_CONNECTION_STRING")));

//If you have any services that should be used as DI, then they also must be registered as like this
    services.AddScoped<Interface, Class>(); //Interface refer to the service interface while class is the actual service you will use.
}

Tagged : / / / /

Server Bug Fix: Access to the path ‘\Core-01MediaTemp’ is denied – aspnet user needed

Original Source Link

Windows 2016 | IIS10 | IIS Server Farm

For starters.
I just now moved all sites from the backup server to the Web Forest.
And the one site I am having the titled issue with luckily is not a part of the site where people can see it—just me.

I had run into this issue before a few months ago and was able to resolve it without to much fuss.
However, there seems to be an issue now.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and
the configured application pool identity on IIS 7.5) that is used if
the application is not impersonating. If the application is
impersonating via , the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the authenticated
request user.

Users added to [Security] tab permissions

IUSR NETWORK SERVICE [email protected]
(Custom pool identity)
Administrators (Default)

(ASPNET User is NOT available, and I have no idea on how to enable this user)

To grant ASP.NET access to a file, right-click the file in File Explorer,
choose “Properties” and select the Security tab.
Click “Add”
to add the appropriate user or group.
Highlight the ASP.NET account,
and check the boxes for the desired access.

The issue now is, I DO NOT have the ASPNET user as an option to chose from, and this used to be an option a few months back.
So, what happened to it?

UPDATE
I followed the instructions on this site here.
ASPNET User Identity Model
I could not get the aspnet_regiis -I to work with any other version of asp.net on the server.
So, I had to use the one which is used on the page.
After installing asp.net 3.0 (Which comes with 2.0)
And then running the aspnet_regiis -I
I rebooted the server.
Still, the ASPNET user does not show.

So, I am at a loss, people.
It used to be here, as I was using the user before in the 2016 server.
So, what happened to it?
Clearly, it is needed for this site, since the Network Service does not do it.

Any ideas on this would be great.
Wayne

You asked a very good question with exact error messages, so it is clear what issue you met. So we go through the whole process.

An ASP.NET application (likely .NET 2.x/3.x) gave you an error message

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and
the configured application pool identity on IIS 7.5) that is used if
the application is not impersonating. If the application is
impersonating via , the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

which should be very clear if the web app runs on IIS 5.x/6.0/7.0. However, time flies so people can be surprised to see that accounts like IUSR_MACHINENAME or {MACHINE}ASPNET are gone, and Network Service is not the base process identity any more (IIS 7.5+).

Thus, the only correct hint is “the configured application pool identity on IIS 7.5”, which like I commented above is the custom domain account you used for this web application.

To summarize the issue again, ASP.NET web app running under a custom domain account cannot access a remote file share, and reports an error.

With this in mind, the rest is rather simple for you, to locate whether the right permissions are set. Even though on your servers actually another problem (failed shared configuration) prevents the things from working, you can easily resolve it.

So, keep up the good work on your side to always focus on the exact symptoms and ask the right questions.

Tagged : / /

Server Bug Fix: Access to the path ‘\Core-01MediaTemp’ is denied – aspnet user needed

Original Source Link

Windows 2016 | IIS10 | IIS Server Farm

For starters.
I just now moved all sites from the backup server to the Web Forest.
And the one site I am having the titled issue with luckily is not a part of the site where people can see it—just me.

I had run into this issue before a few months ago and was able to resolve it without to much fuss.
However, there seems to be an issue now.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and
the configured application pool identity on IIS 7.5) that is used if
the application is not impersonating. If the application is
impersonating via , the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the authenticated
request user.

Users added to [Security] tab permissions

IUSR NETWORK SERVICE [email protected]
(Custom pool identity)
Administrators (Default)

(ASPNET User is NOT available, and I have no idea on how to enable this user)

To grant ASP.NET access to a file, right-click the file in File Explorer,
choose “Properties” and select the Security tab.
Click “Add”
to add the appropriate user or group.
Highlight the ASP.NET account,
and check the boxes for the desired access.

The issue now is, I DO NOT have the ASPNET user as an option to chose from, and this used to be an option a few months back.
So, what happened to it?

UPDATE
I followed the instructions on this site here.
ASPNET User Identity Model
I could not get the aspnet_regiis -I to work with any other version of asp.net on the server.
So, I had to use the one which is used on the page.
After installing asp.net 3.0 (Which comes with 2.0)
And then running the aspnet_regiis -I
I rebooted the server.
Still, the ASPNET user does not show.

So, I am at a loss, people.
It used to be here, as I was using the user before in the 2016 server.
So, what happened to it?
Clearly, it is needed for this site, since the Network Service does not do it.

Any ideas on this would be great.
Wayne

You asked a very good question with exact error messages, so it is clear what issue you met. So we go through the whole process.

An ASP.NET application (likely .NET 2.x/3.x) gave you an error message

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and
the configured application pool identity on IIS 7.5) that is used if
the application is not impersonating. If the application is
impersonating via , the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

which should be very clear if the web app runs on IIS 5.x/6.0/7.0. However, time flies so people can be surprised to see that accounts like IUSR_MACHINENAME or {MACHINE}ASPNET are gone, and Network Service is not the base process identity any more (IIS 7.5+).

Thus, the only correct hint is “the configured application pool identity on IIS 7.5”, which like I commented above is the custom domain account you used for this web application.

To summarize the issue again, ASP.NET web app running under a custom domain account cannot access a remote file share, and reports an error.

With this in mind, the rest is rather simple for you, to locate whether the right permissions are set. Even though on your servers actually another problem (failed shared configuration) prevents the things from working, you can easily resolve it.

So, keep up the good work on your side to always focus on the exact symptoms and ask the right questions.

Tagged : / /

Code Bug Fix: Could not find control ‘TextName2’ in ControlParameter ‘Name’

Original Source Link

Trying to Insert TextBox to view in Gridview in Database but this error keeping show to me :

Could not find control ‘TextName2’ in ControlParameter ‘Name’.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find control ‘TextName2’ in ControlParameter ‘Name’.

            <InsertParameters>

                <asp:ControlParameter ControlID="TextName2" PropertyName="Text" Name="Name"
                    Type="String"></asp:ControlParameter>

</InsertParameters>
         <asp:TextBox ID="TextName2" runat="server" Height="32px" Width="211px" 
                              Text='<%# Bind("Name") %>'></asp:TextBox>
Tagged : / / / /

Server Bug Fix: How can I add ACL permissions for IIS APPPOOL* accounts via Powershell?

Original Source Link

I want to be able to set the IIS account for new websites to have modify permissions. I have the following script:

function Set-ModifyPermission ($directory, $username, $domain = 'IIS APPPOOL') {
    $inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit"
    $propagation = [system.security.accesscontrol.PropagationFlags]"None"
    $acl = Get-Acl $directory
    $user = New-Object System.Security.Principal.NTAccount($domain, $username )
    $accessrule = New-Object system.security.AccessControl.FileSystemAccessRule($user, "Modify", $inherit, $propagation, "Allow")
    $acl.AddAccessRule($accessrule)
    set-acl -aclobject $acl $directory
}

However, when I run it, I get errors like this:

Set-Acl : The trust relationship between this workstation and the primary domain failed.

I think this is because IIS APPPOOL isn’t a real domain, but is a weird prefix on a kind-of-fake account. Is there a correct way to refer to that account so that I can make this work?

First of all, use Set-Acl like this, as the directory path is the first positional argument:

Set-Acl $directory $acl

Second, you should create the user object with only one argument:

$user = New-Object System.Security.Principal.NTAccount("$domain\$username")

UPDATE: Seems that it won’t accept the “IIS APPPOOLAppPoolName” as an NTAccount identifier. Now, there are two ways to accomplish what you are trying to do:

  1. Create a new SID object with the AppPoolIdentities SID and translate it into an NTAccount, like this: http://iformattable.blogspot.com/2007/12/convert-sid-to-ntaccount-with.html, and you should be able to treat it like any other NTAccount object. If you still want to be able to pass domain/usernames for real accounts, built in some simple logic that defaults to the AppPool SID if username is “AweSomeAppPool” and domain is empty, just as an example.

  2. Use PowerShell to invoke icacls.exe, and use it to grant/revoke whatever permissions you want, like this (first normal icacls form command prompt, then powershell, notice the difference):

    icacls.exe test.txt /grant "IIS AppPoolDefaultAppPool":(OI)(CI)M

    cmd /c icacls test.txt /grant "IIS AppPoolDefaultAppPool:(OI)(CI)M"

If you go for the second option, be sure to test them manually first, i haven’t had a chance to test these specific examples myself, but it should work

Something like this should do the trick for you. It should be able to resolve IIS APPPOOlAnything as well…

function Set-AclOnPath
{
    param(
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string] $Path,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string] $DomainAccount
    )

    #Put whatever permission you want here
    $permission = $DomainAccount,"ReadAndExecute","Allow"
    $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission

    $acl = Get-Acl $Path
    $acl.SetAccessRule($accessRule)
    $acl | Set-Acl $Path
}

The following works in Windows 2012 to get a SID for the IIS site. It requires the IIS Provider which uses the WebAdministration powershell module, but this article indicates it will work on Windows 2008R2.

$appPoolName = 'MyAppPool'
$appPoolSid = (Get-ItemProperty IIS:AppPools$appPool).applicationPoolSid
$identifier = New-Object System.Security.Principal.SecurityIdentifier $appPoolSid
$user = $identifier.Translate([System.Security.Principal.NTAccount])

As of IIS 10/Windows 10/Server 2016, the WebAdministration module is deprecated and we’re expected to use the new IISAdministration Powershell module instead. Here’s how to get the application pool SID translated to the virtual user using the new module:

Import-Module IISAdministration
$manager = Get-IISServerManager
$appPoolName = 'MyAppPool'
$appPoolSid = $manager.ApplicationPools["$appPoolName"].RawAttributes['applicationPoolSid']
$identifier = New-Object System.Security.Principal.SecurityIdentifier $appPoolSid
$user = $identifier.Translate([System.Security.Principal.NTAccount])

The following worked for me in Windows 2012, couldn’t get the other examples working:

Import-Module WebAdministration

$appPoolName='MyAppPool'
$folderDirectory='C:MyWebFolder'

$appPoolSid = (Get-ItemProperty IIS:AppPools$appPoolName).applicationPoolSid

Write-Output "App Pool User $appPoolSid"

$identifier = New-Object System.Security.Principal.SecurityIdentifier $appPoolSid
$user = $identifier.Translate([System.Security.Principal.NTAccount])

Write-Output "Translated User $user.Value"

$acl = Get-Acl $folderDirectory
$acl.SetAccessRuleProtection($True, $False)
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule($user, "FullControl", "ContainerInherit", ObjectInherit", "None", "Allow")
$acl.AddAccessRule($rule)
$acl | set-acl -path $folderDirectory

Tagged : / / / /

Server Bug Fix: How can I add ACL permissions for IIS APPPOOL* accounts via Powershell?

Original Source Link

I want to be able to set the IIS account for new websites to have modify permissions. I have the following script:

function Set-ModifyPermission ($directory, $username, $domain = 'IIS APPPOOL') {
    $inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit"
    $propagation = [system.security.accesscontrol.PropagationFlags]"None"
    $acl = Get-Acl $directory
    $user = New-Object System.Security.Principal.NTAccount($domain, $username )
    $accessrule = New-Object system.security.AccessControl.FileSystemAccessRule($user, "Modify", $inherit, $propagation, "Allow")
    $acl.AddAccessRule($accessrule)
    set-acl -aclobject $acl $directory
}

However, when I run it, I get errors like this:

Set-Acl : The trust relationship between this workstation and the primary domain failed.

I think this is because IIS APPPOOL isn’t a real domain, but is a weird prefix on a kind-of-fake account. Is there a correct way to refer to that account so that I can make this work?

First of all, use Set-Acl like this, as the directory path is the first positional argument:

Set-Acl $directory $acl

Second, you should create the user object with only one argument:

$user = New-Object System.Security.Principal.NTAccount("$domain\$username")

UPDATE: Seems that it won’t accept the “IIS APPPOOLAppPoolName” as an NTAccount identifier. Now, there are two ways to accomplish what you are trying to do:

  1. Create a new SID object with the AppPoolIdentities SID and translate it into an NTAccount, like this: http://iformattable.blogspot.com/2007/12/convert-sid-to-ntaccount-with.html, and you should be able to treat it like any other NTAccount object. If you still want to be able to pass domain/usernames for real accounts, built in some simple logic that defaults to the AppPool SID if username is “AweSomeAppPool” and domain is empty, just as an example.

  2. Use PowerShell to invoke icacls.exe, and use it to grant/revoke whatever permissions you want, like this (first normal icacls form command prompt, then powershell, notice the difference):

    icacls.exe test.txt /grant "IIS AppPoolDefaultAppPool":(OI)(CI)M

    cmd /c icacls test.txt /grant "IIS AppPoolDefaultAppPool:(OI)(CI)M"

If you go for the second option, be sure to test them manually first, i haven’t had a chance to test these specific examples myself, but it should work

Something like this should do the trick for you. It should be able to resolve IIS APPPOOlAnything as well…

function Set-AclOnPath
{
    param(
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string] $Path,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string] $DomainAccount
    )

    #Put whatever permission you want here
    $permission = $DomainAccount,"ReadAndExecute","Allow"
    $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission

    $acl = Get-Acl $Path
    $acl.SetAccessRule($accessRule)
    $acl | Set-Acl $Path
}

The following works in Windows 2012 to get a SID for the IIS site. It requires the IIS Provider which uses the WebAdministration powershell module, but this article indicates it will work on Windows 2008R2.

$appPoolName = 'MyAppPool'
$appPoolSid = (Get-ItemProperty IIS:AppPools$appPool).applicationPoolSid
$identifier = New-Object System.Security.Principal.SecurityIdentifier $appPoolSid
$user = $identifier.Translate([System.Security.Principal.NTAccount])

As of IIS 10/Windows 10/Server 2016, the WebAdministration module is deprecated and we’re expected to use the new IISAdministration Powershell module instead. Here’s how to get the application pool SID translated to the virtual user using the new module:

Import-Module IISAdministration
$manager = Get-IISServerManager
$appPoolName = 'MyAppPool'
$appPoolSid = $manager.ApplicationPools["$appPoolName"].RawAttributes['applicationPoolSid']
$identifier = New-Object System.Security.Principal.SecurityIdentifier $appPoolSid
$user = $identifier.Translate([System.Security.Principal.NTAccount])

The following worked for me in Windows 2012, couldn’t get the other examples working:

Import-Module WebAdministration

$appPoolName='MyAppPool'
$folderDirectory='C:MyWebFolder'

$appPoolSid = (Get-ItemProperty IIS:AppPools$appPoolName).applicationPoolSid

Write-Output "App Pool User $appPoolSid"

$identifier = New-Object System.Security.Principal.SecurityIdentifier $appPoolSid
$user = $identifier.Translate([System.Security.Principal.NTAccount])

Write-Output "Translated User $user.Value"

$acl = Get-Acl $folderDirectory
$acl.SetAccessRuleProtection($True, $False)
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule($user, "FullControl", "ContainerInherit", ObjectInherit", "None", "Allow")
$acl.AddAccessRule($rule)
$acl | set-acl -path $folderDirectory

Tagged : / / / /

Code Bug Fix: Which Controller method is being called “Only once” in ASP.NET MVC?

Original Source Link

I am developing an application which including user register, login and some other stuff. I have "Remember Me" feature when user login. But I also have to log every visit of the user through a web service.

I tried protected override void Initialize(System.Web.Routing.RequestContext requestContext) on home page but it is called every time the page is called.

I am using cookies so global.asax application_start is not working. Is there anyone who did something like that before_ What is the right approach for this?

Tagged : / / /

Code Bug Fix: Get second maximum number only if highest one not available in SQL and not return null value

Original Source Link

My Table:

<table >
  <tr>
    <th>ProductCode</th>
    <th>year_numb</th>
    <th>month_numb</th>
    <th>qty_instock</th>
  </tr>
  <tr>
    <td>002792</td>
    <td>2020</td>
    <td>3</td>
    <td>5</td>
  </tr>
  <tr>
    <td>002792</td>
    <td>2020</td>
    <td>4</td>
    <td>1</td>
  </tr>
  <tr>
    <td>002792</td>
    <td>2020</td>
    <td>5</td>
    <td>4</td>
  </tr>
  <tr>
    <td>000002</td>
    <td>2020</td>
    <td>3</td>
    <td>4</td>
  </tr>
    <tr>
    <td>000002</td>
    <td>2020</td>
    <td>4</td>
    <td>10</td>
  </tr>
</table>

SQL:

strSql1 = "SELECT qty_instock FROM StockMaster WHERE ProductCode = '" + strProdCode + "' AND month_numb = (SELECT MAX(month_numb) from StockMaster)"

This one only return values with the highest month_number which is ‘5’ for this matter however ‘000002’ only returns a null value. please give me a solution to display second highest number from month_number.

Needed output:

<table >
  <tr>
    <th>ProductCode</th>
    <th>year_numb</th>
    <th>month_numb</th>
    <th>qty_instock</th>
  </tr>
 
  <tr>
    <td>002792</td>
    <td>2020</td>
    <td>5</td>
    <td>4</td>
  </tr>
    <tr>
    <td>000002</td>
    <td>2020</td>
    <td>4</td>
    <td>10</td>
  </tr>
</table>

If you need to get max qty_instock for given product code strProdCode then you should use the next query:

select top 1 qty_instock
from StockMaster
where ProductCode = strProdCode
order by month_numb desc;

This query for strProdCode = '002792' returns value 4, and for value strProdCode = '000002' returns 10. Here is complete sample that demostrates this query.

As a side note, if you are going to use this query in you C# code then it is recommended to use parameters in SQL statemets instead of directly inlining values into the query. This post describes why it is important to use parameters.

You can try below query to get the desired result –

Sample Table & Data

Declare @Product table 
(ProductCode varchar(10), [Year] int, month_numb int, qty_instock int)

insert into  @Product
values
('002792',  2020  ,  4 ,  1 ),
('002792',  2020  ,  5 ,  1 ),
('000002',  2020  ,  3 ,  13),
('000002',  2020  ,  4 ,  5 )

Query

;With cte(ProductCode, [Year], month_numb )
as
(select ProductCode, [Year], max(month_numb) month_numb
from @Product p
group by ProductCode, [Year]
) 
select p.* from @Product p 
inner join cte on p.ProductCode = cte.ProductCode 
and p.Year = cte.Year
and p.month_numb = cte.month_numb

Tagged : / /

Code Bug Fix: Adding Bootstrap to Site.Master

Original Source Link

I need to add bootstrap in site.master page. I did this in order to achieve this:

<asp:ScriptManager runat="server">
            <Scripts>
                <%--To learn more about bundling scripts in ScriptManager see https://go.microsoft.com/fwlink/?LinkID=301884 --%>
                <%--Framework Scripts--%>
                <asp:ScriptReference Name="MsAjaxBundle" />
                <asp:ScriptReference Name="jquery" />
                <asp:ScriptReference Name="bootstrap" path="~/Scripts/bootstrap.js" />

                <%--Site Scripts--%>
            </Scripts>

Is this enough or do I need to add reference to bootstrap.min.js too and if I do where should I add it.

I would suggest keeping js and CSS files in 2 different folders. Then import the bootstrap css files in the header and the bootstrap js files in the body as follows:

<head runat="server">
    <link rel="stylesheet" href='<%= ResolveUrl("~/js/bootstrapCSSFilename1.css") %>' />
    <link rel="stylesheet" href='<%= ResolveUrl("~/js/bootstrapCSSFilename2.css") %>' />
</head>
<body>
    <script src='<%= ResolveUrl("~/css/bootStrapFileName1.js") %>'></script>
    <script src='<%= ResolveUrl("~/css/bootStrapFileName2.js") %>'></script>
</body>

replace the filename1, 2, etc.. as per the js files you have in bootstrap package.
Following is a sample folder screenshot with the bootstrap files.

Usual bootstrap css files

bootstrap js files

Tagged : /