[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

ASP.NET

124K

Solutions

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi
I have built an ASP.net web application that I need design help with. I don't want to share my entire project with a cuss designer but rather give him just enough access to see my mark up code.
I have never done this before so am looking for advice on the best way to do this.
Is there a way in Visual Studio 2017 to collaborate in this way?
0
Microsoft Azure 2017
LVL 12
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

I hope somoene can help me with this. This is my second day trying to figure this issue and I'm close to banging my head against my soft cube wall :)

I'll go step by step. I've created a sample code to show it. You can copy and paste it in VS2017 and run it. Call Test() method

1. This is the sample code
 public class LogicOperatorTest
	    {
		    public LogicOperatorTest(bool isAll = false)
		    {
			    IsNumeric = IsString = IsDate = IsBool = IsObject = isAll;
			    EnableValueField = true;
		    }

		    public string Key { get; set; }
		    public string Name { get; set; }
		    public bool IsNumeric { get; set; }
		    public bool IsString { get; set; }
		    public bool IsDate { get; set; }
		    public bool IsBool { get; set; }

		    public bool IsObject { get; set; }
		    public bool EnableValueField { get; set; }

		    //public bool Selected { get; set; } //
		    public string DataType { get; set; }//
		    public string ClassStringBuilder { get; set; }//
		    public string DisplayStyle { get; set; }//
		    
	    }
		private void Test()
	    {
		    var sb1 = new System.Text.StringBuilder();
		    var classStringBuilder = new System.Text.StringBuilder();

		    List<List<LogicOperatorTest>> myList = new List<List<LogicOperatorTest>>();

		    List<string> FilterFieldKeys = new List<string>(new string[] { "27", "18"});
		    List<string> FilterOperators = new List<string>(new string[] { "gt", "nc" });
		    List<string> filterField = new 

Open in new window

0
I want send mail from a asp.net application. My question is: which is the best approach to this?
0
Hi, I'm trying to delete all the children divs that I created dynamically in a parent div. The parent div contains different controls, not just divs.

 var imgContainer = document.getElementById("ContentPlaceHolder1_div_Container");
    var childDivs = imgContainer.getElementsByTagName("div");

    var NumberOfDivs = childDivs.length;

    for (i = 0; i < NumberOfDivs; i++) {
        imgContainer.removeChild(childDivs[i]);
    }

Open in new window


If there is only one child div, the code works fine. However, when I append multiple divs I get the following error

"JavaScript runtime error: No such interface supported"

Any ideas?

Thanks
0
When styling a website, when we set style on a body or html element , as below. will this override style for all the inputs as well?


body{
   font-size : 12px;
   font-family: sans-serif;
}

or like this

* {
      font-size : 12px;
      font-family: sans-serif;
    }
0
Hi Experts,

I'm trying to connect to a Access DB in order to sanitize some data using PHP. I Have already enabled by PHP PDO ODBC driver  (uncomment the extension=php_pdo_odbc.dll line in php.ini) and restarted my IIS.

I get the following code...
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] SQLDriverConnect: 63 [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x14b8 Thread 0x11e4 DBC 0x22f8444 Jet'.' in C:\inetpub\wwwroot\DICE-AccessNOC\includes\access_db.php:18 Stack trace: #0 C:\inetpub\wwwroot\DICE-AccessNOC\includes\access_db.php(18): PDO->__construct('odbc:Driver={Mi...') #1 C:\inetpub\wwwroot\DICE-AccessNOC\find-distinct.php(6): Access_DB::getDB() #2 {main} thrown in C:\inetpub\wwwroot\DICE-AccessNOC\includes\access_db.php on line 18

Open in new window


My includes/access_db.php is
<?php

$TBL = "TBL_DICE_Factorial_Analysis";

class Access_DB{
 
    private static $db;
    
    private function __construct() { } //no new objects can be created
    
    public static function getDB() {    
    
        $access_path = "Z:\\Business\\CLIENTS\\DICE Assessment\\Received Files\\NOC_Database_Backup_2_PHPCopy.accdb";
         
        //One connection per browser session
        if (!isset($db)) {
            $dsn = "odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)}; Dbq=$access_path;";
            self::$db = new PDO($dsn);
        }
        return self::$db;
    }
    
    public function __destruct() {

        self::$db->close();
        
    }
}

function print_variable($var, $label = '', $raw = true){

    echo '<br>=========START=========<br>';
    echo '<b>' . $label . '</b>';

    if ($raw == true) echo '<pre>';

    print_r($var);

    if ($raw == true) echo '</pre>';
    echo '<br>=========END=========<br>';
}
?>

Open in new window


The caller is
<?php
    require_once 'includes/access_db.php';
    
    $query = "SELECT * FROM $TBL ORDER  BY NOC_Code, NOC_Occupation; ";

    $db = Access_DB::getDB();

    $statement = $db->prepare($query);
    $statement->execute();
    $rows = $statement->fetchAll(PDO::FETCH_ASSOC);
    $statement->closeCursor();

    print_variable($rows, 'Fact Analysis');
?>

Open in new window


I have also given full permissions to HKEY_LOCAL_MACHINE\SOFTWARE\ODBC and its children to IIS_IUSRS, but the issue persists.

I'm also posting this under ASP, as I see on Google, this also occurs under ASP.

Any help will be greatly appreciated.
0
How do I extract parent values and all child values from deserialized JSON, one record per child value, to a List<T>?

Sample JSON:  json_sample.txt

So from the attached sample JSON we wish to add the following records to the  list:
Record 1:  aen: Y456789, studentID: 1016, need: MMM, rank: 1
Record 2:  aen: Y456789, studentID: 1016, need: PPP, rank: 2

All records with "needs : null" to be ignored and all "need": "Not Specified" to be ignored. Sample code below:



      CTFNeedDataBatch =
                           (from people in myJSON.content
                            select new NeedCTF
                            {
                                studID = people.StudentBasic.studentId.ToString(),
                                AEN= people.StudentBasic.aen.ToString(),
                                Code = (people.StudentSensitive.needs == null ? people.StudentSensitive.needs[0].need.ToString() : ""),
                                Priority = (people.StudentSensitive.needs == null ? people.StudentSensitive.needs[0].rank.ToString() : ""),
                            }).Where(w => w.Code != "").ToList();


The problem with this code is we are not getting any values from the "needs" element and even if we were, I doubt we would be getting more than one record from an element that has more than one need.
0
Hi, I'm using  jquery (3.1.1), in my ASP.NET app,  but it gives me the the following error when I try to execute the function below...

"0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'ajax'"

 <script src="Scripts/jquery-3.1.1.min.js"></script>

 function InsertTest(mark) {
            $.ajax({
                        type: "POST",
                        data: param,
               
                        url: "/default.aspx/TestMe",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        data: JSON.stringify({ 'param': param}),
                
                    });
        };

Open in new window


Any ideas??
Thanks!
0
I have an svg icon in my asp.net web site. how can I apply css to this svg file by just using a css file.
say I want to change the color of the this svg icon. is it possible to write just a css rule to do this?

<img src="content/images/companyicon.svg" alt="">
0
Hi Guys,
I have a web application asp.net mvc.
I would like to know if is it possible to upload files automatically from source path on the hard drive:
Let me give you an example:

Lets say I have this these code:
and I return 3 paths of img source and created them on the dom:
 for (let i = 0; i < files.length; i++) {
            $("#ImagesReturn").append('<img style="display:none" src="' + files[i] + '"/>')
        }

Open in new window


Here I got the html on the dom:
 <img style="display:none" src="D:\FIles_test_for_new_viewer\AddPages\2.PNG">
<img style="display:none" src="D:\FIles_test_for_new_viewer\AddPages\1.PNG">
<img style="display:none" src="D:\FIles_test_for_new_viewer\AddPages\3.PNG"></div>

Open in new window


now what I want to do is to upload these 3 paths to the server automatically:
Like loop:
var listOffiles = $("#ImagesReturn img");
        for (let i = 0; i < listOffiles.length; i++) {
            //here I would like to get the [b]files[0][/b] like I click on <input type="file">
        }

Open in new window


There is a way to do something like that? if not please let me know your ideas.



Thank you.
0
Amazon Web Services
LVL 12
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

This is not homework, seriously :)

My manager said there's some client conference and they want to show that we care about security. He said they want to leave a USB on a table and have a note on it ... something like...financial data...and see who takes it. If that person puts the USB/flash drive in his laptop, he wants the user to see a fake message... you have a virus whatever.

He said this can be done with some ini file and ini file needs to be on the USB/flash drive and when it's inserted, that ini is going to run. Something like that.

I pushed it off on the jr developer :) but now I'm thinking about it and I'm wondering how the code can be done for it. Any ideas?
1
Not familiar with this syntax.  Is this instantiating an instance of the class?  Why is there no "new" keyword?

InspectionsByTasksViewModel vm = (DataContext as InspectionsByTasksViewModel);

Open in new window

0
Dropdown is my least favorite control :)

This is MVC/C#.

This is the code
<select class="form-control zone1" name="Schedules[@i].DefaultTimeZone">
				@{
						var selectedId = anySavedSchedules ? item.DefaultTimeZone : Model.UserDefaultTimezone;
						foreach (var zone in ViewBag.Timezones)
							{

							<option @(zone.Id == selectedId ? "selected=\"selected\"" : "") value="@zone.Id">@zone.DisplayName</option>
							}
					}
				</select>

Open in new window


I see the "selected" but when the page loads, I don't see the value in the dropdown What am I missing?

ddl.png
0
Jump starting Azure development skills

I am a C#.NET Ful Stack, ASP.NET developer, with limited experience with AWS.

I'd like to understand Azure well enough to talk the talk and land a contract job which requires some experience with Azure.

What training videos should I start with to get me started on this road?

Thanks.
0
Hi,

I have made a function to synchronize some tables between two or more databases in my app. But I needed a more efficient way of doing it, faster especially.
I would prefer a .net component instead of an application that does it (like Redgate) since it is much cheaper to distribute with the application.
Someone who knows some component?
best regards
0
I am using ASP.NET MVC 5 with entity framework version 6. I have the PagedList.MVC nuget package installed. I get the error listed below when attempting to sort in my Index view. I'm sure it is something really simple that I am overlooking.

The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.'

Controller Code listed below:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using ITRA.Models;
using PagedList;
using PagedList.Mvc;

namespace ITRA.Controllers
{
    public class SSP_ControlController : Controller
    {
        private RiskAssessmentEntities2 db = new RiskAssessmentEntities2();

        // GET: SSP_Control
        public ViewResult Index(string sortOrder, string currentFilter, string searchString, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NISTIDSortParm = String.IsNullOrEmpty(sortOrder) ? "NISTID_asc" : "";
            ViewBag.TitleSortParm = String.IsNullOrEmpty(sortOrder) ? "Title_asc" : "";
            ViewBag.WorksheetStatementSortParm = String.IsNullOrEmpty(sortOrder) ? "WorksheetStatement_asc" : "";

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            

Open in new window

0
Windows Authentication in Chrome does not works as expected from AD/Domain environment.

It works perfect in Firefox after adding the http://app.domain.local to network.automatic-ntlm-auth.trusted-uris

It works also good in Edge and Internet Explorer after adding the URL in Local Intranet - Sites.

I expect it to work in Chrome too. But I am always being promted. Any ideas?

I have tried with or without Negotiate security method for Windows Authentification. I am currently using only NTLM.

Chrome version 69.0.3497.100 64 bit.
IIS 8 and MVC (Webform) (newer version) ASP.Net app
0
First i'm sorry for my english.
My problem is with my SharePoint Website running on MOSS 2007 on a Windows Server 2003 with IIS 6.0 ans ASP Net 2.0.
My website was working very well but after some configuration on ISS console i got this issue.
When i try to access to my website with this URL: http://myserver i got an error Message : Content view is not allowed for this virtual directory.
But when i try with this URL http://mywebsite/default.aspx it's working but my CSS and JS file are not loaded. So i get an aspx page without my customisation.
I tried to give all right to my directory wwwroot to different user like thé ASP user, to ISS user ... Without any result.
The strange thing it's :
- when i try to go to my default site which use ASP Net 1.0 it's working well...
- When i try to read my SharePoint list from ACCESS 2007 or directly from the web by the direct URL it's Works
- but when i try to open my website from SharePoint designer it's impossible.

Thanks on avance for any help.
0
I am going to have a developer work on a few ASP.NET web pages.  They will be connecting the web page to a backend SQL database hosted on Microsoft Azure.  I am concerned about security in the development process.  When he is working on the Azure SQL database, is there a role I can assign him and the application that will have certain restrictions?  Is there a role that controls what he can do with the data?  My guess is that the data should be backed up before he works on it, but are there other measures?  I will most certainly change the authentication when the application goes live, but he may need to access the app and database again so he would need a restricted account.  Any help in this area would be appreciated.
0
Fundamentals of JavaScript
LVL 12
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

I am using bootstrap 4 in asp.net web site. how to apply bootstrap dropdown style to asp net controls. for example, asp:dropdown.

<asp:dropdown id="ddl" runat="server" /> .

also, when we use  bootstrap classes to create form and inputs , like below. how to add  vertical space between the inputs ?

<div class="form-control">
   <div class="row">
       <div class="col-6>
            <div class="form-group">
                   <asp:textbox id="txt" runat="server">
              </div>
              ,<div class="form-group">
                     <asp:dropdown .....
0
I've used Leaflet.js before...at my last job. We had a JSON file that held the longitude and latitude. It was generated using C# code.

I'm following this example https://asmaloney.com/2014/01/code/creating-an-interactive-map-with-leaflet-and-openstreetmap/

In our database, we have a list of addresses. How can I generate a JSON file of those addresses? In the link above, it's in "The JSON Data" section of the site. How is that file generated?
0
Hi,

We have a website with a password protected section where our customers can access their own important and confidential documents. However, we are concerned that credentials might be provided intentionally from one user to another who belongs to a company that is not our customer in order to spy sensitive data. I have seen that some websites detect a suspicious behavior when validating credentials based on, form example, device type, browser, and other data. Our website was developed with .NET ASP.NET technology and I have found a tool called DeviceDetector.NET that is supposed to perform the detection I need.

Is this a good choice/approach or is there a better way to achieve the goal of detecting suspicious behavior access?

Respectfully,
Jorge Maldonado
0
what is a best approach to this -

I am trying to open an existing aspx page , with few controls which  includes html controls line input, select ,  user controls ( ascx) and also custom third party controls like multi select dropdown.

thing  I have tried is to make an ajax call, shown below. I don't know if this is a good approach.

or is it better to, try to convert the aspx page to a ascx page and then load it to the Modal popup.


$.ajax({
       //make a get call to aspx page.
       //on success, append to the modal content div
});
0
In this example from this post

https://www.experts-exchange.com/questions/29119837/clearing-a-Header-Row-CheckBox-in-a-DataGrid.html

My DataGrid looked like this:

p1.PNG
Notice my CheckBox column is the 1st column of the DataGrid

My button click event looked like this, this worked fine:

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ' reset header checkbox
        Dim dgHeader As DataGridItem = DGEmployees.Controls(0).Controls(0)
        Dim targetChkBox As CheckBox = dgHeader.Controls(0).Controls(1)
        targetChkBox.Checked = False
        CType(DGEmployees.Controls(0).Controls(0).FindControl("DataGridEmployees_SelectAll"), CheckBox).Checked = False

    End Sub

Open in new window



In these 2 lines of code:

        Dim dgHeader As DataGridItem = DGEmployees.Controls(0).Controls(0)
        Dim targetChkBox As CheckBox = dgHeader.Controls(0).Controls(1)

What are these references?

.Controls(0).Controls(0)
.Controls(0).Controls(1)

Is that the first row and 1st column?

So if my datagrid looked like this (the checkboxcolumn is the 6th column of my datagrid),

p2.PNG
How do I reference the 6th column of my datagrid?

I tried this but it didn't work,
    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ' reset header checkbox
        Dim dgHeader As DataGridItem = DGEmployees.Controls(0).Controls(0)
        Dim targetChkBox As CheckBox = dgHeader.Controls(0).Controls(6)
        targetChkBox.Checked = False
        CType(DGEmployees.Controls(0).Controls(0).FindControl("DataGridEmployees_SelectAll"), CheckBox).Checked = False

    End Sub

Open in new window


I get this error message:

Specified argument was out of the range of valid values.
Parameter name: index
0
I am trying to pass an actionlink parameter to the "Create" action in the controller. I am trying to create and insert a row into the database because I need the "RequestID" for later use.  What I have tried thus far is to create a prop in the my viewmodel named "NewRequestId".  I am calling an ajax "GET" json request to send the requestId to a hidden field on the "Index" view.  The main object here is to have the requestId at the time the "public ActionResult Create()", which is the HttpGet, gets called. The hidden textbox field is being populated but it does not seem to want to pass to the controller.

1. Index
2. GetRequest to
the 3. Create (But I need to have to the requestId from the database at this time)

//this is on the Index.chtml
@Html.ActionLink("Create New", "Create", "Request", null, new { id = NewRequestId, onclick = "GetRequestId();" })

Open in new window


public JsonResult GetRequestId()
{
            Request request = new Request();
            DateTime now = DateTime.Now;

            User userid = requestRepository.GetUserByUserName(Environment.UserName);            

            request.UserName = userid.UserName;
            request.RequestDate = now;
            request.TicketStatusId = 7; // 7 = Created, 1 = Submitted
            request.HasNotifications = false;
            request.AddToWatchList = false;

            db.Requests.Add(request);

            db.SaveChanges();
            
            return new JsonResult { Data = request, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }

Open in new window


//GET: Request/Create
public ActionResult Create(int requestId)
{
Request request = db.Requests.Find(requestId);

//Add the rest of the data to the request record and update that id

db.SaveChanges();

return View(request);
 }

Open in new window


//Javascript function
function GetRequestId(data) {
    var requestId = "";

    $.ajax(
        {
            url: '/Request/GetRequestId',
            //data: { requestId },
            type: "GET",
            dataType: "json",
            success: function (result) {
                $("#NewRequestId").val(result.RequestId);
                requestId = result.RequestId;
            }            
        });
   
    location.href = '/Request/Create/' + $("#NewRequestId").val();
    return false;
};

Open in new window

0

ASP.NET

124K

Solutions

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications