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 am developing a C# ASP.NET application using VS2015 and .Net Framework 4.5.

I use the following code:

I set a breakpoint at   -->  File.Move(f.FullName, newFile);  

Do you understand why the file extension did not change from *.tiff to *.ard.out in the foreach loop ?

private static void ProcessFile(string filePathIn, string filePathOut1, string filePathOut2, string filePathOut3)
        {            
            DirectoryInfo di = new DirectoryInfo(@MyGlobals.TARGET_DIR_IN);
            FileInfo[] fi = di.GetFiles("*.tiff");
            foreach (FileInfo f in fi)
            {                
                int ix = f.FullName.LastIndexOf("\\") + 1;
                string newFile = f.FullName.Substring(0, ix) + "BOACK.BOACK.BOAIMAGE.BOAIMAGE." + f.FullName.Substring(ix).Replace(".ard.out", ".tiff");
                File.Move(f.FullName, newFile);   <--- Breakpoint
            }

I see the following values at the breakpoint:


>? f.FullName
"\\\\v\\region\\na\\appl\\ctrls\\cashcontrol\\data\\dev\\BOA\\data\\NAMECHANGE\\20170831509245224004.tiff"

>? newFile
"\\\\v\\region\\na\\appl\\ctrls\\cashcontrol\\data\\dev\\BOA\\data\\NAMECHANGE\\BOACK.BOACK.BOAIMAGE.BOAIMAGE.20170831509245224004.tiff"
>
1
I am developing a C# ASP.NET application using C# with VS2015 and .NetFramework 4.5.
I have the following code at the bottom of this page which works fine.

string bankprefix = "Bank ABC";

f.FullName  =  "\\\\v\\region\\na\\appl\\ctrls\\cashcontrol\\data\\dev\\BOA\\data\\NAMECHANGE\\20170831509245224004.ard.out"

The file path is an input parameter and thus its length can vary.

I want to place a fixed string titled "bankprefix" in front of the portion of the f.FullName records that start with
20 numeric characters followed by ".ard.out".

For example:
20170831509245224004.ard.out.
I don't want to put the string "bankprefix" in front of the entire FullName which includes the directory path.


Do you know how I would do this?

BEFORE IMAGE
"\\\\v\\region\\na\\appl\\ctrls\\cashcontrol\\data\\dev\\BOA\\data\\NAMECHANGE\\20170831509245224004.ard.out"

AFTER IMAGE
"\\\\v\\region\\na\\appl\\ctrls\\cashcontrol\\data\\dev\\BOA\\data\\NAMECHANGE\\20170831509245224004.ard.out"
-----------------

            DirectoryInfo di = new DirectoryInfo(@MyGlobals.TARGET_DIR_IN);
            FileInfo[] fi = di.GetFiles("*.tiff");
            foreach (FileInfo f in fi)
            {
                   File.Move(f.FullName, f.FullName.ToString().Replace(".tiff", ".ard.out"));                
            }

>? f.FullName
"\\\\v\\region\\na\\appl\\ctrls\\cashcontrol\\data\\dev\\BOA\\data\\NAMECHANGE\\Bank ABC20170831509245224004.tiff"
1
I have this function which calls a stored procedure the pulls records from the database.

This stored procedure takes one parameter, pid:

    private void getRecs(int pid)
    {
           SqlConnection conn = new SqlConnection(connStr);
        //Dim cmd As New SqlCommand(s, conn) switched to stored proc below
           SqlCommand cmd = new SqlCommand("[uspGetAllRecs]", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlParameter p1 = new SqlParameter("@pid", pid);
        cmd.Parameters.Add(p1);
        conn.Open();
        cmd.ExecuteNonQuery();
        conn.Close();

    }

Open in new window


Then I am trying to call this function on pageload event but it is giving me an error:

        string pid = Session["PID"].ToString();
             getRecs(pid);

This is the error:

Error      1      The best overloaded method match for 'getRecs(int)' has some invalid arguments

Any ideas?
0
I am developing an ASP.NET application using C# with VS2010 and .NETFramework 4.0
Is there a way to revise the following snippet so that only files with a file extension of *.tiff are processed inside the foreach loop (and all other file extension types are bypassed)?


            DirectoryInfo di = new DirectoryInfo(@MyGlobals.TARGET_DIR_IN);
            FileInfo[] fi = di.GetFiles();
            foreach (FileInfo f in fi)
            {
                do something
            }
1
I am developing an ASP.NET application in C#, using VS2010 and .NET Framework 4.0

I use the following snippet to revised the file extensions of the incoming files to *.ard.out

How would I revise this code to include a prefix filename (variable name of "bankprefix") ?

As you can see, the file name consists of a fixed length of 20 numeric characters followed by a period and then the file extension name.
-----------------------
For example:

string bankprefix = "Bank ABC.";

BEFORE:                                                 AFTER:
20170831509245224004.tiff    ->       Bank ABC.20170831509245224004.ard.out      

-----------------------------------------------------------------------------------------------------------------------------

            DirectoryInfo di = new DirectoryInfo(@MyGlobals.TARGET_DIR_IN);
            FileInfo[] fi = di.GetFiles();
            foreach (FileInfo f in fi)
            {
                File.Move(f.FullName, f.FullName.ToString().Replace(".tiff", ".ard.out"));              
            }
0
I installed visual studios express
on windows 10
I chose web developer version so I can run html/javascript

version
but I can not run an html file on a browser
I see file does not exist
or advertisement splash page for asp

can not run on a browser
0
Hi EE,

What is wrong with the below code?

Public ReadOnly Property Heats() As DataTable
        Get
            Dim obj As Object = Me.Session("Employees")
            If (Not obj Is Nothing) Then
                Return CType(obj, DataTable)
            End If

            Dim myDataTable As DataTable = New DataTable
            myDataTable = GetDataTable("SELECT * FROM Employee")
            Me.Session("Employees") = myDataTable
            Return myDataTable
        End Get
    End Property

    Protected Sub radGridHeat_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) 'Handles radGridHeat.NeedDataSource
        Me.radGridHeat.DataSource = Me.Employees
        Me.Heats.PrimaryKey = New DataColumn() {Me.Heats.Columns("nEmployeeID")}
    End Sub

Open in new window


Getting an error :
stringnotrecognized.JPG
Please guide.

Regards,
D Patel
0
Hi EE,

In the Radgrid while using the following Code I'm getting the error :

Protected Sub radGridHeat_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles radGridHeat.PreRender
        If Not IsPostBack And Me.radGridHeat.MasterTableView.Items.Count > 1 Then
            Me.radGridHeat.MasterTableView.Items(1).Edit = True
            [b][i]Me.radGridHeat.MasterTableView.Rebind()[/i][/b]
        End If
    End Sub

Open in new window


Error :
error_radgrid_bind.JPG
And uncommenting the line
Me.radGridHeat.MasterTableView.Rebind()
Application runs but it misbehaves. (Such as it showing the loading process but not execute. Also no errors to know where it is stuck)

radgrid_process.JPG
See I have used "User Control" in my application and RadGrid EditMode is set to 'EditForms'.

Can you guide me how do I resolve the same?

Regards,
D Patel
0
my problem is i need to have a check out button either asp:button or the form submit that will run c# code and then submit the form.

1. user press button
2. c# code will create order
3. c# code will run code for shipping detail (buy shipping)
4. C# code will run code for accounting
5. submit form that will display an iframe

Code for form


<div id="myForm" style='display:none'>
  <div id='inline_content'>

       <script>
        $(".inline").colorbox({
            inline: true,
            opacity: 0.5, // overlay a bit less dark
            innerWidth: 640,
            innerHeight: 390,
            onComplete: function () { document.OutputForm.submit() }
        });

       
    </script>
    <form name="OutputForm" method="post" action="https://test.authorize.net/payment/payment" target="payframe" id="LinkTo" class="ShowForm">
      <input type="hidden" name="Token" value="<%=token%>" />
       </form>

        <iframe id="payframe" name="payframe"></iframe>
</div>
0
Is there a way to keep on same tab when saving the page. I have five tabs and it goes back to first tab after Save. It updates the record but I would like to be in same tab. The postback cause it to behave this way isn't it?
Any help?
0
I'm looking for library/Nuget package that i can use for encrypting and decrypting passwords and store it in database.

I have looked at popular libraries which are mostly "one way hashing" , but I need one that I can decrypt the password as well.
0
I have a requirement to run a complex formula and update columns in a table. For this I need to loop through rows in table.
Currently I am using sql cursor for it but the end customer get Timeout error in Asp.net application because this  in one SP I have three nested cursors.

I need to know what alternatives would be helpful for me without lossing to much of performance?
0
I have installed the runtime version of CRRuntime_64bit_13_0_12. But when running the website, I am getting the following error.

Method not found: 'CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag CrystalDecisions.ReportAppServer.ReportDefModel.ISCRExportOptions.get_ExportOptionsEx()'.

I have followed instruction and help notes on google search but none solved my problem.  I checked up the bin directory and found that the dll are 32 bit which is the reason for the above error as my web site is deployed on a 64 bit server.

So where can I donwload the dlls for 64 bit for crystal reports.
0
Hi Experts,

Using MSTest how would you write an Assert for MyObjStringCollection (line 33) for the code below:

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;

namespace UnitTestProject1
{
    public class MyObj
    {
        public MyObj()
        {
            MyObjStringCollection = new List<string>();
        }

        public int MyObjInt { get; set; }
        public string MyObjString { get; set; }
        public IEnumerable<string> MyObjStringCollection { get; set; }


    }

    [TestClass]
    public class UnitTest1
    {

        [TestMethod]
        public void TestMyObj()
        {
            //Arrange
            var sut = new MyObj();

            //Assert
            Assert.AreEqual(0, sut.MyObjInt);
            Assert.IsNull(sut.MyObjString);
            Assert.AreEqual("", sut.MyObjStringCollection, "MyObjStringCollection should be empty and not null");
        }
    }
}

Open in new window


The error message:
Error Message
Run time image:
run time image
TIA!
0
Hi Experts

Could you confim/ correct my own  interpretation on how MS-SQLServer service is used by Visual Studio'a Entity Framework, this case?

Accordingly with:
img001
During run-time the database  students. mdf  is "attatched" to MS-SQLServer catalog ?

(Similarlly to manually attach the mdf by using SQLServer Management studio and then change the connection string to use Catalog)

Am I correct om my conclusion?

Thanks in advance.
0
I can not find where the redirct part in a asp:login when i first did this i had it in a test site. now i am starting to switch to the final website hosting account to test it there only adding the files i need.

When the user logs in it took them back to the page they where on or the defalut page.

Now the program stays on the login page but they are loged in.

Where do i find in the code the settings for this i have looked but have not found them
0
Hi Experts,

I have a form with dropdowns and buttons. When I select a 'Location' from the dropdown, it fills the 'Rooms' and generate a financial report for that 'Location'. I have written all the server side code in 'Onchange' event. I want to disable the form so that no body should able to click anything else while this operation is going on and display some wait message. How can I do this. Please help.

Thanks in advance.
0
Hi,
Within the page, I want to know what it does, further to such codes
function openPopup2() {
    var lblctrl = document.getElementById("lb_pict2");
    if (lblctrl.innerHTML != "") {
        $("#myPanel2").dialog("open");
    }
    return false;
}

Open in new window

0
Hello.
Kindly guide me.
in my asp.net project, where i can place my public functions/procedures/variables that can be called from any other page/form
Without using a class.
i am using vb.net.
0
I have supported various web services over many years but need to clearly what is meant by the term "web API."

Please give me a short description so I can judge if I have worked with this or not.

Thanks
0
In our business DLL, we have some variables declared as "Public Shared". This DLL is used by our website.

After a user logs into our site, Session vars hold the login info. (Nothing in Application vars as those would be shared across users, which we don't want.) Every time the user hits the DB, it connects with that info, setting the DLL's "Public Shared" variables to certain values and using them during that quick connection.

It's been fine for years.

Now suddenly, we're having incredibly rare occasions where one user is in the midst of a process, another user kicks off a process, and when that user sets those DLL "Public Shared" variables, the first user finds those values changed. For instance...

User 1 starts connection and process, setting MyDLL.Var1 = "A"
User 2 starts connection and process, setting MyDLL.Var1 = "B"
User 1 process is ending, but finds MyDLL.Var1 = "B"

I verified it by making a long dummy process. It seems odd to me that a DLL on the site would share these values across all the users logging into the website... but apparently that's how it works. (I was only ever concerned about Application variables -- not variables tucked away deep inside a DLL that I never coded.)

Since it's been fine for years, my guess is we recently created longer processes. So what's the solution? We have 50+ "Public Shared" variables that need to remain declared that way because they are used in other apps, including solutions with multiple projects -- so we …
0
assume I have 1000+ resumes in docs or pdf files. and I have a web site written in aspx/c# and I alllow someone to put visual studio in the textbox and once the button is submitted, it search all 1000+ resumes in docs or pdf and try to search anything that have visual studio or look like visual studio in  text, and then return me the list of doc. name.

with above situation, where i can find the tools to search ....
0
I have this code but the th headers are duplicating. Perhaps an expert can help.
          <asp:ListView ID="lstIssues" runat="server">
                             <ItemTemplate>
                                 <div>
                                     <table class="responsive">
                                         <thead>
                                             <tr>
                                                 <th>
                                                     Issue
                                                 </th>
                                                 <th>
                                                     Status
                                                 </th>
                                             </tr>
                                         </thead>
                                         <tbody>
                                         <tr><td class="medium-3">
                                            <%#Eval("[ISSUES]")%>                                              
                                             </td>
                                             <td class="medium-2 left">
                                            <%#Eval("ISSUESTATUS")%>                                              
                                             </td>

                                         </tr>
                                             </tbody>
                                     </table>
        

Open in new window

0
I am working on an ASP.Net MVC Project and I want to prevent a button click event from firing if there is a change in any checkbox or dropdown state.

For instance I have a HTML table that has a number of checkboxes in the rows \ columns.  If they are unchanged then I want a button event to fire because the is no change to the underlying data.

However, if there is a change in state for instance a single or multiple checkboxes have changed and the Save button has not been clicked I do not want the copy button to be active.

I would be grateful for an example on how I would go about this.

Thanks

Simon
0
strUploadPath = "\\m222513vaps3119.prd.automdir.com\InetOnTracAdvantagePlans$"
      Upload.LogonUser "prd","vDirOntracAdvPl","Mitzelplik!"
      Upload.Save(strUploadPath)
I am getting the below error:
Persits.Upload.1 error '800a001e'

Logon failure: unknown user name or bad password.  

/excel_upload.asp, line 56

Can someone help ????
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