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

Hello, I am developing an online game panel.  As per screenshot there is  top menu with different values  and Middle menu with some values.

In top menu 0000-0999 is selected and in Middle menu 0000-0099 is selected and there are labels and text boxes from 0000 to 0099 - 100 boxes.

So when user will click on 0100-0199 menu from Middle menu it should show next 100 text boxes and labels with value 0100 to 0199.

Likewise if user selected 1000-1999 menu from Top menu the value of Middle menu will change and of all the  labels and text boxes.

I have to load these labels and boxes dynamically so that page will not take much time to load because if you calculate there are 10,000 labels and text boxes.

Can someone tell me how could I do this.?  Also when user click on any menu, labels and boxes will load but it should not refresh the page and I don't wish to use ASP.NET AJAX.

Page performance is very important for me.  I am loading these values from db.  I am using ASP.NET 4.0

https://prnt.sc/r5o9wg
0
I have a website running on a Windows 2019 Server in IIS, using asp.net and C#.

When the user goes to my site, I want to immediately redirect them to my new site. I don't need to mask the URL. It's perfectly fine to have the new URL appear in the browser bar. The new site uses https so I don't want the redirect to attempt to mask or otherwise cause the browser to display a warning that the site is not secure.

I know there are various ways to redirect one web page to another - through html, javascript and even in asp.net.

Can anyone share a sample code that can give the fastest, most reliable redirect?

If I try to handle the redirect using JUST html:

<!DOCTYPE html>
<html>
   <head>
      <title>My Site</title>
      <meta http-equiv = "refresh" content = "0; url = https://mynewwebsite.com" />
   </head>
   <body>
      <p>Welcome to My New Site</p>
   </body>
</html>

Open in new window


...even when I set the time to 0, the user still (briefly) sees this placeholder page until it finally redirects. I don't like that.

I thought about doing it using JavaScript but what if the user has JS disabled?

So then I thought maybe it should be handled in asp.net but I guess that would require a round trip to the server. Not the end of the world but ... maybe a COMBINATION of these techniques starting with the fastest method and then using something as a fallback?

(Note: I know I can also handle this redirect on the web server, but I don't want to redirect ALL instances of my old domain. Only the home page)
0
Is there a way to set the password display length for a textbox(mode=password)?

Example: Textbox's value is "test" so that is 4 characters in length, but i want it to show as 10 characters in length. Ideally i would like this to not affect the value itself.

I found two tricks listed below but I am looking for either a native solution or something a little cleaner.

1: Have two variables and swap between the two for onfocus and onblur. To make this work though i would need to add extra code so it would save the correct value on save.

2: Add a label around the texbox and have it overlay the real value. You would hide/show the label using onfocus and onblur. This is closer to what i want since i can just save the value without doing anything extra.

thanks!
0
I was using Virtual directory on IIS website, But I dont understand its significance , I have set Virtual director as another server IP for eg \\192.168.2.2\Download and I wanted to upload my file on Virtual director so its automatically get copied to \\192.168.2.2\Download location but it seems to upload on same server where IIS website is set,  Please let me know if anyone has idea on that.
0
I have mapped network drive to one of server for eg. Y drive which is connected with another server \\192.168.1.1
I am trying to upload file on Y drive but its throwing error, Please help me for same.
Below is my code

If fuSheet.HasFile Then
               'UploadPath = Server.MapPath("~/Y:/") + "Project" + ProjectId + "_" + fuSheet.FileName
 
                fuSheet.SaveAs(UploadPath)
                Path = UploadPath
            End If

Open in new window


Error is : fileUpload.Error:The given path's format is not supported.

If I change code like that
If fuSheet.HasFile Then
               'UploadPath = Server.MapPath("/Y:/") + "Project" + ProjectId + "_" + fuSheet.FileName
 
                fuSheet.SaveAs(UploadPath)
                Path = UploadPath
            End If

Open in new window


Then Error: fileUpload.Error:The given path's format is not supported.

If I change code like below
If fuSheet.HasFile Then
               'UploadPath = Server.MapPath("Y:/") + "Project" + ProjectId + "_" + fuSheet.FileName
 
                fuSheet.SaveAs(UploadPath)
                Path = UploadPath
            End If

Open in new window

Then Error fileUpload.Error:'Y:/' is a physical path, but a virtual path was expected.
0
I have created Virtual Directory named as Downloadserver on my website IIS (192.168.1.1\Download), That 192.168.1.1 is another server, while website is setup on 192.168.1.2,  , Now I am trying to upload file there using below code:
 Dim filenamepath As String = System.IO.Path.Combine(Server.MapPath("~/DownloadServer/"), fuSheet.FileName)
 fuSheet.PostedFile.SaveAs(filenamepath)

 But its not uploading file on \\192.168.1.1\Download location, Please help me to understand this.
0
I have a MVC 5 .net 4.7.2 identity website. this works well. i want to generate a password reset token from a separate WinForms (4.5.2) application. (UserManager.GeneratePasswordResetTokenAsync)..

As far as I can tell I need to reference Microsoft.Owin.Security.DataProtection and Microsoft.AspNet.Identity.Owin.. I am having trouble creating a UserManager object.
I'm struggling with the minimum requirements WinForms needs to make this... it seems like the entityframework is required or something.

Ideally I would like to call the ResetPassword action from the WinForms project, but I figure if I can run the GeneratePasswordResetTokenAsync method then I can create and send the email from code with my own method.. getting the userid is no problem, as i know how to access the database etc...

I realise the above is fairly vague, but hopefully enough information to provide advise. thanks.
0
I am using asp.net website, I want code which will allow me to upload and download on different server using network drive, for eg. Network drive is \\192.168.1.1
UserName=aaa, Password=aaa
Then  It should upload and download file on that location. Please help me for same.
0
I am attaching demo code,  Basically same code working OK on IE11, Chrome, Safari but getting failed on Edge, Here are 2 pages:
1> contact1.aspx
     It is without master page, Basically its calling Jquery function on textbox change, when I put special character for eg &# and click on submit button
   then it shows alert of special character and same time it calling update button on codebehind. What i want is if special character entered and click on submit
button then it should just display alert message and submit button event should not be called, Same thing working on Chrome,IE11, Safari.
2> ContactusN.aspx
    It is with master page, Basically its calling Jquery function on textbox change, when I put special character for eg &# and click on submit button
   then it shows alert of special character and same time it calling update button on code behind. What i want is if special character entered and we click on submit
button then it should just display alert message and submit button event should not be called, Same thing working on Chrome,IE11, Safari.


   Please help me to fix this issue.
0
i use area in MVC like below URL
https://www.c-sharpcorner.com/article/simple-modularity-through-areas-in-asp-net-mvc/

Under View BLUE, if I want to create /Domain/Blue/SubFolder/1

http://localhost:2714/Parent/Blue/List/Index, how can I do that? The example shown I can only add one controller
0
I am getting String was not recognize as valid DateTime when I try to upload to the database.  Any Ideas see code below..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Security.Principal;
 
namespace CertificationCapture {
    public partial class _Default : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            if (!IsPostBack)
            {
                Cal1.Visible = false;
                Cal_exp.Visible = false;
            }
        }
 
 
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (Cal1.Visible = false)
            {
                Cal1.Visible = true;
            }
            else
            {
                Cal1.Visible = true;
            }
        }
 
        protected void Cal1_SelectionChanged(object sender, EventArgs e)
        {
            ent_date.Text = Convert.ToString(Cal1.SelectedDate.ToString());
            Cal1.Visible = false;
        }
 
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            if (Cal_exp.Visible = false)
            {
                Cal_exp.Visible = true;
            }
            else
            {
                Cal_exp.Visible = true;
            }
 
        }
 
        protected void …
0
I am using Asp.net website 3.5 and trying to connect with MYSQL, I have installed mysql software and created DB,NEW USER, TABLE and trying to use that on Asp.net code, when I tried
then its giving me error:
MySql.Data.Mysql.Client provider not registered on local machine, I even add MySql.Data dll on my website still error not going, here is my web.config file:

<?xml version="1.0"?>
<configuration>
  <appSettings/>
  <connectionStrings>
    <add name="WebAppConString" connectionString="server=127.0.0.1,User Id=webuser;Password= webuser2020;Port=3306; Database=webappdemo;" providerName="MySql.Data.Mysql.Client"/>
    <!--<add name="WebAppConnString" connectionString="Server=127.0.0.1;UserID=webuser;Password=webuser2020;Database=webappdemo1;Port=3306;" providerName="MySql.Data.Mysql.Client"/>-->
  </connectionStrings>
  <system.web>
    <!-- 
            Visual Basic options:
            Set strict="true" to disallow all data type conversions 
            where data loss can occur. 
            Set explicit="true" to force declaration of all variables.
        -->
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
      <assemblies>
        <add assembly="MySql.Data, Version=8.0.19.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
        <add assembly="MySql.Web, Version=8.0.19.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
      </assemblies>
    </compilation>
    <!--
          The <authentication> section 

Open in new window

0
The following code is taking excel file to MS SQL table. The codes working but have some issue.

1. When the codes ran on my development Window 10 PC, it returns 15000. This is correct because Excel has 15000
2. When the codes ran on IIS 10 or 7, it returns 12000

I add all of the settings I can think of
https://stackoverflow.com/questions/288612/how-to-increase-the-max-upload-file-size-in-asp-net
or
IIS as well.

And the result is the same. Do you have ideas how to fix it?


Protected Sub test_Click(sender As Object, e As EventArgs)
        'Upload and save the file
        Dim excelPath As String = Server.MapPath("~/Files/") + Path.GetFileName(BCTFileUpload.PostedFile.FileName)

         


        BCTFileUpload.SaveAs(excelPath)

        Dim connString As String = String.Empty
        Dim extension As String = Path.GetExtension(BCTFileUpload.PostedFile.FileName)
        Select Case extension
            Case ".xls"
                'Excel 97-03
                connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES'"
                Exit Select
            Case ".xlsx"
                'Excel 07 or higher
                connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES'"
                Exit Select

        End Select
        connString = String.Format(connString, excelPath)
        Using excel_con As New OleDbConnection(connString)
            

Open in new window

0
I need a Autocomplete search in a text box(like Google search) and the values are from arraylist. The value selected should also be selected in Radgrid
0
when i publish my project (web application) in visual studio 2019
I face this errors
Image-3.png
0
I use the following codes in aspx web application.
It takes excel file and then insert a record to the database.
The code is working until it reaches 12,000 records.

We verify the webconfig and excel file itself and do not have any issues.

We use window server2012



https://www.experts-exchange.com/askQuestion.jsp#

Open in new window


 public static void UploadFile(ref System.IO.Stream fileStream)
    {
        string aidString = HttpContext.Current.Session[ezGlobals.id].ToString();

        string shortDateString = DateTime.Now.ToShortDateString().Replace("/", "");
        string hourString = DateTime.Now.Hour.ToString();
        string minuteString = DateTime.Now.Minute.ToString();
        string secondString = DateTime.Now.Second.ToString();

        string pathPrefix = "~/Staff/Portal/Home/Files/";
        string pathPostfix = ".xls";

        string path = HttpContext.Current.Server.MapPath(pathPrefix + aidString + shortDateString + hourString + minuteString + secondString + pathPostfix);

        var newFileStream = File.Create(path);
        fileStream.Seek(0, SeekOrigin.Begin);
        fileStream.CopyTo(newFileStream);
        newFileStream.Close();

        fileStream.Seek(0, SeekOrigin.Begin);

        var doc = new HtmlDocument();
        doc.Load(fileStream);
        var nodes = doc.DocumentNode.SelectNodes("//table/tr");
        DataTable table = new DataTable("MyTable");

        var headers = nodes[0]
            .Elements("th")
            

Open in new window

0
I am using asp.net website, I am using upload tool, what I am looking is to upload my files on network drive, Also that drive should be mapped throgh asp.net using Network url, Username and password. It should setup an network upload file there and get disconnected, is it possible, Please help
0
I have purchased hosting package on Godaddy server, I have added one domain there, now I want to run my Asp.net website pages there, I am using asp.net with vb website 3.5/4.0, Can
I setup that on Godaddy, I saw there is plex admin, Please help me to setup my website there.
0
I have one Jquery[ Written in $(document).ready(function ())] on my master page which identify Input controller.

Now this Jquery calls a JavaScript function which is written in .js file and it shows Alert box when Special Character identify in Input controller.

On child page we have textbox along with submit button. There are two scenario below, in which second is giving problem.

1. When we enter special character along with some text in textbox and hit on other area of the screen Alert box comes up with proper message[Which is Correct and working as well].

2. When we enter special character along with some text in textbox and Hit on Submit, It Shows Alert box with the right message but then function on submit button got called and popup comes up which hides our Alert Box.[Now this is the Problem].

Note that, this thing is happening in EDGE browser only.
0
Hi,

I am working on ASP.Net using c#

I have deployed my application on another IIS webserver.

On new server I am getting error as below. But the same code is working on another webserver.

Process information: 
    Process ID: 7456 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\MYWEBAPP 
 
Exception information: 
    Exception type: HttpException 
    Exception message: Session state has created a session id, but cannot save it because the response was already flushed by the application.
   at System.Web.SessionState.SessionIDManager.SaveSessionID(HttpContext context, String id, Boolean& redirected, Boolean& cookieAdded)
   at System.Web.SessionState.SessionStateModule.CreateSessionId()
   at System.Web.SessionState.SessionStateModule.DelayedGetSessionId()

Open in new window


Please advise the reason and the fix.
0
Hi
The following ASP.net VB.net code works in debug mode but does not work after I publish the site. Why might this be? Thanks

    Protected Sub btnContactMe_Click(sender As Object, e As EventArgs) Handles btnContactMe.Click

        Try
            Dim S As String = "Office2Web Enquiry "
            'NOTE OUNCTUATION MESSES WITH EMAILING
            S = S & "Name " & Me.txtName.Text & " Email " & Me.txtEmail.Text & " Contact Number " & Me.txtContactNumber.Text & " Company " & Me.txtCompany.Text
            S = S & " Description " & Me.TextBox1.Text
            Dim sEmailResult As String
            ''sEmailResult = oSendMailMessage("info@online-excel.com", "consulting@office2web.com.au", "murray@office2web.com.au", "", "Office2Web Enquiry", S, True)
            sEmailResult = oSendMailMessage("info@online-excel.com", "consulting@office2web.com.au", "murbro9@yahoo.com", "murray@office2web.com.au", "Office2Web Enquiry", S, True)

            If sEmailResult = "Email Success" Then
                Me.lblEmailResult.Text = "Message Sent. Thank you."
            Else
                Me.lblEmailResult.Text = "Sorry! Message not sent. " & sEmailResult
            End If
        Catch ex As Exception
            Me.lblEmailResult.Text = "Error message not sent " & ex.Message
        End Try

    End Sub

    Public Function oSendMailMessage(ByVal from As String, ByVal recepient As String, ByVal bcc As String,
                             ByVal cc As String,…
0
caotyre
Using DataTables, I need to set the bottom of it to allow about 100 more pixels for the drop down menu to not be cut off.

Any suggestions what my options are?


This is the datatables jquery plugin. Not to be confused with datatables in asp.net.

https://datatables.net/

Thanks!
0
Originally, I have a website written by asp.net www.abc.com and have many landing page called landing1.aspx landing2.aspx and etc.

We recently re-build the website written in mvc and now we want to fix the redirect.
assume someone search our webpage on google.com and have www.abc.com/landing1.aspx and landing2.aspx and etc.

how can we take all of the aspx webpages and redirect back to our domain www.abc.com?

Thanks,
0
A corporate network has an email account where no authentication is required to send emails internally

I'm a little unsure how its done as the SmtpClient needs authentication (as I can see)

They gave me a code sample which works on their end


.Item(cdoSendUsingMethod) = cdoSendUsingPort

.Item(cdoSMTPServerPort) = 25

.Item(cdoSMTPServer) = "mail.theircorp.com" 

.Item(cdoSMTPAuthenticate) = cdoBasic

.Item(cdoSendUserName) = "nouser@theircorp.com"

.Item(cdoSendPassword) = ""

.Item(cdoSendEmailAddress) = "nouser@theircorp.com"

Open in new window


But I assume this is old tech.


How would I achieve this using SmtpClient
0
Hi i have a rad grid, where by I am displaying data as pagination in the grid and I need to select particular row based on some conditions.I am able to select the row but sometime it displays the selected row on some other pages.

I need help to display the selected row as first page  or need to display selected as first row.

TIA
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