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

I have an asp.net web application with a grid.  One column has a bulleted list with displaytype as Hyperlink. It is databound. I return some folder paths in this list. If the path is a share on a server all works find as example 1.

In example 1 the spaces are replace by %20.

But for some reason in Example 2 when the actual drive letter is used the spaces are replaced by %2520 which then does not work.

1.file://server1/scanned/ASB/DE/AGOPSOWICZ,%20DANIEL/AGOPSOWICZ,%20DANIEL%202018%2011%2014


2.file:///Q:/ASB/DE/AGOPSOWICZ,%2520DANIEL/AGOPSOWICZ,%2520DANIEL%25202019%252002%252021


What causes this %2520 to happen? In example 1 with %20 the link works.

It looks like an encoding issue in the Bulleted list Hyperlink. It is adding the %2520 on the Example 2.

Thanks,

Roger
0
CompTIA Security+
LVL 13
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Hi,

I have these classes:

Public Class Party
    Public Property partyIdentifier As String
    Public Property email As String
    Public Property telephone As String
    Public Property role As String
End Class

Public Class Car
    Public Property registrationNumber As String
    Public Property registrationNumberMissing As Boolean
    Public Property model As String
    Public Property used As Boolean
    Public Property year As Integer
    Public Property mileage As Integer
    Public Property objectGroupType As String
End Class

Public Class Calculation
    Public Property cashPrice As Integer
    Public Property downPayment As Integer
    Public Property residualDebt As Integer
    Public Property creditTime As Integer
    Public Property interest As Double
End Class

Public Class Insurance
    Public Property monthlyCost As Integer
End Class

Public Class Finance
    Public Property contractType As String
    Public Property customerType As String
    Public Property customerLicenceType As String
    Public Property Parties As List(Of Party)
    Public Property car As Car
    Public Property calculation As Calculation
    Public Property profileId As Integer
    Public Property campaignId As Integer
    Public Property plannedDeliveryDate As DateTime
    Public Property insurance As Insurance
End Class

Open in new window


I'm now trying to build this as an object that I can serialize into json like this:
 If Not Page.IsPostBack Then
            Dim f As New Finance

            ' Basic
            f.contractType = "Installment"
            f.customerType = "Private"
            f.customerLicenceType = "SwedishDriversLicense"

            ' Parties
            Dim p As New Party With {
                .partyIdentifier = "8811119307",
                .email = "nordberg.peter@gmail.com",
                .telephone = "0854545656",
                .role = "Buyer"
            }
            f.Parties.Add(p)

            Dim json As String = JsonConvert.SerializeObject(f)
            Label1.Text = json
        End If

Open in new window


The problem is that I get an error that an object doesn't exist when adding an party item to the lost of parties as can be seen in below image.
 Objkect error
What am I doing wrong and how can I fix it?

Peter
0
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
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
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
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
OWASP: Avoiding Hacker Tricks
LVL 13
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

(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
CompTIA Network+
LVL 13
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

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
for this one... this is how I went about it

From 12 AM to 5 PM... we lose 5 mins each hour so that's 165 mins = 2.75 hours. But this doesn't get 3:35... I'm missing some calculation.



t4.png
0
The answer is 25% decrease. From the graph, I eliminated the 4 answers because the graph for "food and beverages" and "services" has decreased.

Why is it 25%? For example, food & Beverages went from 60 Million to 50 Million and Services went from 20 million to 10 million. I wanted to say... what percentage of 50 million is less than 60 million...

t1.png
0
Why is the answer to this is 100?

That's 500 mins of free call in the grid... it's not 500 per min. One year is 12 months.... hmmm... I don't know how 100 is correct.

t1.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