|
You're loading multiple copies of jQuery, which will never work:
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.0.min.js" type="text/javascript"></script>
...
<script src="~/Scripts/jquery-3.3.1.min.js"></script>
...
@Scripts.Render("~/bundles/jquery")
...
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
</script> You're also loading Bootstrap multiple times.
And you're mixing up the MVC5 approach (@Scripts.Render ) with the ASP.NET Core / .NET 5 tag helper approach (asp-append-version , asp-fallback-src ).
Simplify your scripts so that you only load each library once. And pick the correct approach for the framework you're using.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I left layout scripts as they are and didn't touch them. For the script part I took one from tutorials. What would you suggest in the terms of making both work fine? For me it doesn't matter much if it is MVC5 approach or ASP.NET core as long as it works.
|
|
|
|
|
Well, it does matter which approach you use - the @Scripts.Render approach won't work in ASP.NET Core / .NET 5, and the asp-append-version approach won't work properly in MVC5.
(To be precise, the asp-* attributes will be sent as-is in the rendered HTML, and won't have the expected effect in MVC5.)
If you're using MVC5, stick to the @Scripts.Render approach for your bundles, and remove the asp-* attributes from your <script> tags:
Layout:
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
<script src="~/js/site.min.js"></script>
@RenderSection("scripts", required: false) View:
@section scripts {
<script src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/jquery-ui.min.js"></script>
<link href="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/themes/blitzer/jquery-ui.css" rel="stylesheet" />
<script src="~/Scripts/selectAuthor.js"></script>
}
If you're using ASP.NET Core or .NET 5, use the asp-* attributes instead:
Layout:
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
crossorigin="anonymous"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
</script>
<script src="~/js/site.min.js" asp-append-version="true"></script>
@RenderSection("scripts", required: false) View:
@section scripts {
<script src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/jquery-ui.min.js"></script>
<link href="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/themes/blitzer/jquery-ui.css" rel="stylesheet" />
<script src="~/Scripts/selectAuthor.js" asp-append-version="true"></script>
}
Either way, make sure you only include each library once in the page, and that you include them in the correct order. Check the "view source" option in your browser to view the rendered output to make sure it's doing what you expect.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
It works with the first approach. The only problem is that the dropdown autocomplete menu is not shown directly under the textbox, but rather in the top-left corner.
|
|
|
|
|
|
I have created housie game page, but it is loading slow. Can some one suggest is it coding issue or network issue.
If i run code locally on my pc, it runs fast, but once uploaded on site winmilestone com, it becomes slow.
page winmilestone com / housie
Host server is in usa location, does the site becomes slow if accessed from different countries.
for example, if I click/mark number in housie game, it takes time to refresh but when i test it in my local server, housie game is fast.
how can i test my website speed access across different countries, to check if site is fast in usa and slow in other countries.
|
|
|
|
|
|
Sub Salesorder()
Dim found As Boolean = False
cn.Open()
cm = New SqlCommand("select * from tblbill where SalesOrderNo like '" & txtInvoiceFor.Text & "'", cn)
dr = cm.ExecuteReader
dr.Read()
If dr.HasRows Then found = True Else found = False
dr.Close()
cn.Close()
If found = True Then
cn.Open()
cm = New SqlCommand("update tblbill set INno = @INno where SalesOrderNo=@SalesOrderNo", cn)
With cm.Parameters
.AddWithValue("@INno", txtInvoiceNo.Text)
.AddWithValue("@SalesOrderNo", txtInvoiceFor.Text)
End With
cm.ExecuteNonQuery()
cn.Close()
End If
End Sub
|
|
|
|
|
asp.net is presentation layer this is database layer.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
|
Sorry for another thread.
I have the following that is supposed to read from web.config file.
public string ReadConfig(string ValueToGet)
{
System.Configuration.AppSettingsSection section = (System.Configuration.AppSettingsSection)config.GetSection("appSettings");
return section.Settings[ValueToGet].Value;
}
string URL = Master.ReadConfig("DailyReport");
The application runs perfectly on my local machine but again when run from the server, it gives the following error:
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Any idea how to fix this?
Thanks again in advance
|
|
|
|
|
Which line of code raised the error? The actual problem is usually not to difficult to resolve once you know which reference is the problem. You may wish to edit your question and show the actual contents of the config file. Are you sure all refernces are correctlym spelled?
|
|
|
|
|
Richard, thanks for your response.
This is the ReadConfig () method:
public string ReadConfig(string ValueToGet)
{
System.Configuration.AppSettingsSection section = (System.Configuration.AppSettingsSection)config.GetSection("appSettings");
return section.Settings[ValueToGet].Value;
}
The first error is on this line:
return section.Settings[ValueToGet].Value;
Then ReadConfig tries to call the report with this:
string URL = Master.ReadConfig("DailyReport");
This is the line that generated the second error.
Then this is the web.config content that Master.ReadConfig("DailyReport"); is trying to call:
<add key="DailyReport" value="http://servername/ReportServer?/Reports/DailyReport"/>
I have had similar issues with ReadConfig() function which I was able to resolve.
For instance, This line was generating exact same error:
appVersion.Text = ReadConfig("AppVersion");
and I was able to resolve it with this:
WebConfigurationManager.AppSettings["AppVersion"]
But the Master.ReadConfig(...) line is a bit too challenging.
|
|
|
|
|
|
It's ok.
I have resolved the problem.
|
|
|
|
|
Greetings experts,
I have been struggling with this now for about two days to no avail.
When a user loads our app on a browser, the app determines user's machine name and determines whether user should have a Read Only access to the app or Read/Write access based on two AD group names.
If the user does not belong to any of those groups, access to the app is denied the user with a message indicating so.
This works perfectly on my local machine.
However, when I deploy the app to our server, it does not record user's access level and is constantly denying user access to the app.
We have determined that the server can communicate with our AD.
I am pretty stumped by this.
Can someone please help with the code below and see if it could be written differently?
Many thanks in advance.
IPAddress hostIPAddress = IPAddress.Parse(Request.UserHostName);
IPHostEntry hostInfo = Dns.GetHostEntry(hostIPAddress);
string[] tempSystemName = hostInfo.HostName.Split('.');
WebLibrary.loadUserInformation(Request.LogonUserIdentity.Name, Request.UserHostAddress, tempSystemName[0]);
currentUser.Text = "Current User: " + WebLibrary.visitorFullName + "<br />Access: " + userType + "";
modified 11-Dec-20 13:12pm.
|
|
|
|
|
Is the user actually authenticating to your application? You need to make sure anonymous authentication is turned off, and Kerberos/Windows authentication is turned on.
Depending on your group policy settings, Internet Explorer, Edge, and Chrome should automatically sign the user in to any site which is part of IE's "local intranet" zone. Firefox will need additional configuration in the about:config page:
network.automatic-ntlm-auth.allow-proxies = Truenetwork.negotiate-auth.allow-proxies = Truenetwork.automatic-ntlm-auth.trusted-uris = comma-separated list of host names which should use integrated authentication
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
Great to hear from you sir.
Hope you are staying safe.
I just turned off Anonymous Authentication and enabled Windows Authentication and now it works.
The only issue (a minor one) is that unlike running on my local machine where the application automatically authenticates my account and allows me in, the application is asking me to sign in using my Windows account.
Once this is done, I am automatically in and it works now.
When this app runs on our production server, users are not explicitly asked to sign in. Their identities are automatically recognized and they are in without having to sing in.
Oh well, this is our test site. I guess we have to deal with having to sign in all the time.
UPDATE: I set .Net Rules in IIS as well to deny anonymous users and now it is no longer challenging for authentication.
Many thanks. You have never failed me. Thank you sir.
modified 11-Dec-20 9:31am.
|
|
|
|
|
|
Sorry sir, I forgot to close this out.
Thank you again for your continued assistance.
|
|
|
|
|
In our web solution we have a WebAPI solution, a WebApplication and a local ADFS server.
ADFS server need be setup with exact URL of web app....
For simplicity sake we decided to use (local) IIS hosting and debugging, as in "<a href="http://localhost/myAPI">http://localhost/myAPI</a> " and "https://localhost/myWebApp "
The problem starts when.. and HTTPS app need a certificate...
So I got to:
IIS Management Studio > Default Web Site > Bindings...
And add the ISS Express Development Certificate.
Unfortunately, it feels like Visual Studio is deleting that setting every second time I press F5 / try to debug. And I continuously have to open IIS Management Console and setup the HTTPS binding again and again and again.
Any idea what's going on and fix that bummer?
|
|
|
|
|
@{
foreach (var item in (List<TarefasModel>)ViewBag.MostrarTarefas)
{
<tr>
<td><button type="button" class="btn btn-warning" data-toggle="modal" data-target="'#Modalpopup + @item.Id'">Editar</button></td>
<td>@item.Id</td>
<td>@item.NomeTarefa</td>
<td>@item.Descricao</td>
<td>@item.Atribuido</td>
<td>@item.DataVencimento</td>
<td><button type="button" class="btn btn-success" onclick="Excluir(@item.Id)">Concluido</button></td>
</tr>
}
}
</tbody>
I need pass the ID in modal . I try this :
<td><button type="button" class="btn btn-warning" data-toggle="modal" data-target="'#Modalpopup + @item.Id'">Editar</button></td>
But this not work
|
|
|
|
|
How about you start with the documentation?
Modal · Bootstrap v4.5 - Varying modal content[^]
If that doesn't help, you're going to need to explain what "not working" means, and show the markup and script for your modals.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Friends,
we are integration our application with Azure AD.
After integration application is not working in Chrome and Edge browser, but works in IE.
In Chrome and Edge its navigating to login and after successful login getting redited to Internet Information Services (Windows Server) Page.
During debug, found below line gives Object Reference error in Edge and Chrome browser, whereas giving value in IE.
System.Security.Claims.ClaimsPrincipal.Current.FindFirst("preferred_username").Value
Thanks In Advance,
|
|
|
|