ASP.NET

125K

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 need some help with a request in vb.net. In postman I've succeded to get it to work and I've added the screenshots below
Postman 1Postman 2Postman 3

Now I've used Restsharp (but any request will do) to try and connect through code:

 Dim username As String = "xxx"
        Dim password As String = "xxx"
        Dim client As RestClient = New RestClient("https://url")
        client.Authenticator = New HttpBasicAuthenticator(username, password)
        Dim request = New RestRequest(Method.POST)
        request.AddHeader("Postman-Token", "fa4aa5a9-0c7a-45ad-a8b1-24fd0ac75f8c")
        request.AddHeader("cache-control", "no-cache")
        request.AddHeader("api-version", "1")
        request.AddHeader("Authorization", "Basic xxx")
        request.AddHeader("Content-Type", "application/x-www-form-urlencoded")
        Dim response As IRestResponse = client.Execute(request)

Open in new window


However I get this answer:
{"error":"unsupported_grant_type"}
0
(Even tho I've resigned, I still want to help the team out before I leave on Friday)...

Our code is MVC , C# with EF 6. The mid developer on the team is going on and on about adding IoC to the code, gut it out whatever , to add unit testing. He said IoC for unit testing because we don't have any unit testing in the solution.

What is he talking about?  It's not a huge solution and not a complicated project.

I found this
https://stackoverflow.com/questions/1465849/using-ioc-for-unit-testing

and this http://duanenewman.net/blog/post/better-unit-testing-with-ioc-di-and-mocking/

I know this an open question... but should he do this? Would it add complexity to the code that's already suffering from performance issues and is an old code....written 5 or 6 yrs ago.
0
Trying to get direction on how to handle aspx page (.NET) issue:  

I have a gridview with a Footer that appears after Add button is selected.

There are 4 fields. One is a button to have a pop-up come up and you can select a name with their employee id and populate one of the footer textbox fields.  (this works).

-However, if the user selected wrong name and clicks the pop-up again and selects a new name . error occurs saying that the object is null or not valid.

Where in the code behind or JavaScript can I reset the value to blank if the user clicks the button again for the pop-up before saving.

General direction to review would be appreciated. (where could I possible reset gridview footer field. Also footer in gridview is not always visible until add button is clicked.
0
I'm getting the following error message when trying to write to the event log in my aspx page:

code to write to the event log:
EventLog.WriteEntry ......

error message
[SecurityException: Requested registry access is not allowed.]
   System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +51
   Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +7469849
   System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) +366
   System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName) +194
   System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +205
   System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +87
   System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type) +14
   TagTeam.ttDownloadHandler.ProcessError(HttpContext context, String errorMessage, EventLogEntryType entryType) in e:\InetPub\Products\RevBase\Applications\DotNet\ttDownloadHandler\sl.ashx:395
   TagTeam.ttDownloadHandler.ProcessRequest(HttpContext context) in e:\InetPub\Products\RevBase\Applications\DotNet\ttDownloadHandler\sl.ashx:106
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& 

Open in new window

0
Hi

In my ASP.net GridView the following event isn't firing
GridView1_SelectedIndexChanged
0
I have 2 "Columns" on this page.  You can see the one on the left has a grey background.  The right column will contain a grid which the content will be a result of the selections from the left column controls.

My issue is the height of the left column is small and the list box is not very tall either.  

How do I change the height of the left column?  (Will want the right column to match it).  And I want the list box to take up most of the height too.  Preferable, if the user shrinks/expands the page height, the height of the columns, list box, and datagrid would be reflected.   Is this possible in the way I am doing this?
Thanks,


2colHeight.JPG
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Main.aspx.vb" Inherits="MyProg.Main" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title>MyProg - Main</title>

   <style type="text/css">
        .Initial
        {
            display: block;
            padding: 4px 18px 4px 18px;
            float: left;
            background: url("../Images/InitialImage.png") no-repeat right top;
            color: Black;
            font-weight: bold;
        }
        .Initial:hover
        {
            color: White;
            background: url("../Images/SelectedButton.png") no-repeat right top;
        }
        .Clicked
        {
            float: left;
            display: block;
            background: url("../Images/SelectedButton.png") no-repeat right 

Open in new window

0
Hi,

I have a page that upload file to one of the folders. I have a file that is about 47MB and received this error

The request filtering module is configured to deny a request that exceeds the request content length.

I went to web.config to change the limit.

    <httpRuntime requestValidationMode="2.0" maxRequestLength="102400000"/>

But still does not work. Am I missing something?  thanks
0
Hi

I use the following code to get refer to a GridView template control. How do I get the column index of that template control?

    Private Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowDataBound

        Dim oStatus As String
        Try

            If e.Row.RowType = DataControlRowType.DataRow Then

                Dim lblStatus As Label = CType(e.Row.FindControl("lblStatus"), Label)

Open in new window

0
When using asp.net web forms or asp.net mvc and using a gridview or an html table holding a sql server table with large amount of records and you want to allow exporting of the data to pdf.
What solution or technology do you normally use to export the large amount of data to pdf quickly?
0
Hi

In ASP.net I noticed that variables declared publically in Module1 could be accessed at the same time from different users around the world.
I have now moved my variables (like that below) to the top of each web form so that they are only accessible by the current user. I just want to confirm
that this is true
Public Class Purchase_Order

    Inherits System.Web.UI.Page

    Private objDV As New DataView

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Open in new window

0
Hi

In my ASP.net project I have been assigning usernames to a variable in Module1 when users log in.
The variable is declared as Public oUsername at the top of the module.
When another user logs in it changes that variable to their username.
I thought that Module1 wasn't shared like this. Why is it?
Is there a better way place to store the variable?
0
Hi

In my ASP.net web app I use the following style. How do I make the font much larger?

    <style type="text/css">
             .pleaseWait { width: 30%; height: 100px; background-color: #2964c4; display: none; z-index:999; position:absolute; left:25%; top:10%}
       </style>
0
Hi

In my ASP.net web app I use the code further down  to show a message while my code is running after a button click.
I now want to use this when I click a GridView template button. In the event:
    Private Sub GridView1_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GridView1.RowCommand

            If (e.CommandName = "MyButtonDelete") Then

My current code is as follows

                <div class="pleaseWait">Loading... please wait!</div>
            <div>
                        <asp:Button ID="btnSave" runat="server" BackColor="White" Font-Names="Calibri"
                            ForeColor="#003399" Height="29px" Text="Save" Width="217px" OnClientClick="showLoading(); return false;" />

                </div>

<style type="text/css">
            .pleaseWait { width: 50%; height: 100px; background-color: #cccccc; display: none; z-index:999; position:absolute; left:25%; top:10%}
      </style>
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
      <script type="text/javascript">
            //<![CDATA[
          function showLoading() {
              $('.pleaseWait').show();
          }
            //]]>
       </script>
0
(I don't know where to put this so I put in C#/ASP.Net category)..

For those of you who've been helping me and know I've been dealing with an abusive and moody manager for almost a year... I accepted an offer today.  I've been practicing my resignation since my manager blew up on me in January...over some silly SQL indentation... can you believe it?!...but now I'm not happy about it. Why is it so easy for companies to see good people come and go but so hard to dicipline a manager? (I'm the 3rd one leaving this company). Why is it so easy to see good people come and go but so hard to send a manager to training?

The position I accepted is a little outdated in technology. They said it's Web Forms and Crystal Reports but open to upgrades.  Another developer does Angular and web stuff. Someone else does other stuff. Solid company and the owner also spoke with me. Seemed like a really nice person and my future manager said he has no tolerance for bad behavior.

I had another potential offer that with more recent technologies but they were taking their time and they're like a startup. They've already had layoffs and the company has been bought out. I chose the solid company with a good 401K (I'm getting older and not younger :)) , 3 weeks of vacation and a little increase in my salary. I chose a manager over technology (I read an article on LinkedIn about it). They did say they're looking into AI and new stuff. I do side projects so I can keep up with newer technologies.
9
Hi,

I have a GridView that displays particular files from a folder. Is there a way to sort it desc by the file date?

        DirectoryInfo loanDir = new DirectoryInfo(@"C:\myFoler");

        FileInfo[] filesInDir = loanDir.GetFiles("*" + partialName + "*.*");

        List<FileDetail> files = new List<FileDetail>();
        foreach (FileInfo foundFile in filesInDir)
        {
            files.Add(new FileDetail(foundFile));
        }
        GridView1.DataSource = files;
        GridView1.DataBind();

Open in new window

0
Hi
Is it possible to stop code running in a timer tick when the user is busy typing something
in a GridView template column textbox.
Thanks
0
I want to select a row from a table and present
that row in a asp.net web Form which is developed using the row columns?

I am developing a table which will consist of form data which will be presented
based on a given type.

Isaac
0
Hi

I have an ASP.net GridView with a TextBox template column in it. I have a Timer Control that reloads this GridView
every 5 seconds. The problem is that anything types into one of the TextBoxes disappears. Is there a way to somehow
not clear the TextBoxes in my template column? Should I perhaps just have the timer tick every 2o seconds?

Thanks
0
I have a visual studio 2015 website and every time I run it, it recompiles, even if I haven't made any changes, which is making it tediously slow to get any work done.


On Website Property Pages:
Before running startup page:
Build Web Site

Build Solution action:
X - Build website as part of solution.

But I've had these settings for years and this hasn't been a problem in the past. I want to make sure all changes get compiled before testing.

Suggestions on best settings to keep it moving along, but yet compile changes?

thanks!
0
I have a program that operates on asp.net/vb.net web application.  I have a portion of this program that runs a return of retrieving data for charting in the asp.net chart control.  The initial running of the program works as intended, but when I repeat the process of selecting a different set of data parameters for the chart to display the program slows down.

Is this because of cache?  If so how do I correct this?

Thanks in advance for the help.

Regards,
0
For sending requests to a webservice that deserializes Json, what items in this list are 'required' by the webservice?

HTTPMethod:  
SSLTimeout:  
SSLApplicationID:
SSLCertStore:
SSLCertStorePassword:
SSLVerifyPeer:  
SSLVerifyHost:  
HTTPVersion:
# BasicAuthUser:
# BasicAuthPassword:
# ProxyURI:
# ProxyUser:
# ProxyPassword:
# SendHTTPHeaders:
# HeaderCookieData:
# ResponseCookieFile:
# HeaderSOAPAction:
# HeaderUserAgent:
# HeaderAccept:
# HeaderHost:
# HeaderReferer:
# HeaderConnection:
# HeaderContentType:
# CustomHeaderName(1): Authorization
# CustomHeaderValue(1):
# InputCcsid: 0
# OutputCcsid: 0
# EnableExpectHeader:  
# LocalInterface:
# Enable IPv6:
0
I have the following code

    [HttpPost]
        public PartialViewResult GetDataFromGraphPoint(int Id)
        {
            var Model = processSDT.GetAllDataFromProbeLogId(Id);


            return PartialView("/Views/Home/ImageFromProbeLogId.cshtml", Model);
        }

This all works fine in debug mode
However in IIS the site runs in a virtual directory on some instances
i.e. the location is
localhost/myAppHere/Views/Home/ImageFromProbeLogId.cshtml

But i think its trying to access
localhost/Views/Home/ImageFromProbeLogId.cshtml

So it fails to find the CSHTML file
Is there an easy way in code to make this work in virtual directories and non virtual directories in IIS ?
I could hack it by having a web.config flag that you set running directory....
i.e. SiteRunsIn = "/myAppHere/"

However is there a more elegant way?
0
Why is this answer correct?

Revenue for Q2 is 300. Cost is 250. So profit is 300,000-250,000 = 50,000 but then Q1 and Q3 are also the same.

h3.png
0
No way this is that hard but I've been doing all this math stuff all afternoon and my brain is fried....

X is gas price
Increased by 15% so  X * .15
the price is now 3.91 ..I'm missing something

h1.png
0
For this one...
There are 15 even days. 15 odd days in a month.
On Even days, doctor works for 7 hours
On Odd days , doctor works or 7:30 hours

Nothing jumps out at me to see why 4 hours is correct... not sure how to go about this one...


t5.png
0

ASP.NET

125K

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