1. Sending an email

    Date: 02/04/08     Keywords: asp

    I need to send an email in asp.net 2.0 and cant seem to get it working.

    Whenever I run the code below I get a "Failure sending mail." error from the Catch.

    I know the email settings are correct but I just cant send an email through code.


    Can anyone see anything wrong with my code ?




    try
    {

    string RecipientEmailAddress = Membership.GetUser("nathan").Email;


    //create the mail message
    MailMessage mail = new MailMessage();

    //set the addresses
    mail.From = new MailAddress("test@phalkensystems");
    mail.To.Add("nathan.rimmer@gmail.com");

    //set the content
    mail.Subject = "This is an email";
    mail.Body = "this is the body content of the email.";

    //send the message
    SmtpClient smtp = new SmtpClient();

    smtp.Host = "smtpout.secureserver.net";
    smtp.Port = 70;

    //to authenticate we set the username and password properites on the SmtpClient
    smtp.Credentials = new System.Net.NetworkCredential("test@phalkensystems", "xxxxxxx");
    smtp.Send(mail);


    }

    catch (Exception ex)
    {
    Label1.Text = ex.Message.ToString();
    }

    Source: http://community.livejournal.com/aspdotnet/95284.html

  2. Sending an email

    Date: 02/04/08     Keywords: asp

    I need to send an email in asp.net 2.0 and cant seem to get it working.

    Whenever I run the code below I get a "Failure sending mail." error from the Catch.

    I know the email settings are correct but I just cant send an email through code.


    Can anyone see anything wrong with my code ?




    try
    {

    string RecipientEmailAddress = Membership.GetUser("nathan").Email;


    //create the mail message
    MailMessage mail = new MailMessage();

    //set the addresses
    mail.From = new MailAddress("test@phalkensystems");
    mail.To.Add("nathan.rimmer@gmail.com");

    //set the content
    mail.Subject = "This is an email";
    mail.Body = "this is the body content of the email.";

    //send the message
    SmtpClient smtp = new SmtpClient();

    smtp.Host = "smtpout.secureserver.net";
    smtp.Port = 70;

    //to authenticate we set the username and password properites on the SmtpClient
    smtp.Credentials = new System.Net.NetworkCredential("test@phalkensystems", "xxxxxxx");
    smtp.Send(mail);


    }

    catch (Exception ex)
    {
    Label1.Text = ex.Message.ToString();
    }

    Source: http://aspdotnet.livejournal.com/95284.html

  3. Sending an email

    Date: 02/04/08     Keywords: asp

    I need to send an email in asp.net 2.0 and cant seem to get it working.

    Whenever I run the code below I get a "Failure sending mail." error from the Catch.

    I know the email settings are correct but I just cant send an email through code.


    Can anyone see anything wrong with my code ?




    try
    {

    string RecipientEmailAddress = Membership.GetUser("nathan").Email;


    //create the mail message
    MailMessage mail = new MailMessage();

    //set the addresses
    mail.From = new MailAddress("test@phalkensystems");
    mail.To.Add("nathan.rimmer@gmail.com");

    //set the content
    mail.Subject = "This is an email";
    mail.Body = "this is the body content of the email.";

    //send the message
    SmtpClient smtp = new SmtpClient();

    smtp.Host = "smtpout.secureserver.net";
    smtp.Port = 70;

    //to authenticate we set the username and password properites on the SmtpClient
    smtp.Credentials = new System.Net.NetworkCredential("test@phalkensystems", "xxxxxxx");
    smtp.Send(mail);


    }

    catch (Exception ex)
    {
    Label1.Text = ex.Message.ToString();
    }

    Source: https://aspdotnet.livejournal.com/95284.html

  4. Active Directory Users/Roles

    Date: 01/31/08     Keywords: no keywords

    In Active Directory, I have had a bunch of roles set up, and added users to each role. What I need to do now is get a list of users for a particular role.

    So in AD it would be something like:

    RoleA
    UserA, UserB, UserC

    RoleB
    UserA, UserD

    etc. etc.

    What I want is a way to query Active Directory and get all the users who are in Role A.

    Source: http://community.livejournal.com/aspdotnet/94987.html

  5. Active Directory Users/Roles

    Date: 01/31/08     Keywords: no keywords

    In Active Directory, I have had a bunch of roles set up, and added users to each role. What I need to do now is get a list of users for a particular role.

    So in AD it would be something like:

    RoleA
    UserA, UserB, UserC

    RoleB
    UserA, UserD

    etc. etc.

    What I want is a way to query Active Directory and get all the users who are in Role A.

    Source: http://aspdotnet.livejournal.com/94987.html

  6. Active Directory Users/Roles

    Date: 01/31/08     Keywords: no keywords

    In Active Directory, I have had a bunch of roles set up, and added users to each role. What I need to do now is get a list of users for a particular role.

    So in AD it would be something like:

    RoleA
    UserA, UserB, UserC

    RoleB
    UserA, UserD

    etc. etc.

    What I want is a way to query Active Directory and get all the users who are in Role A.

    Source: https://aspdotnet.livejournal.com/94987.html

  7. Postback question

    Date: 01/28/08     Keywords: database

    How do I run a piece of code each time a page is displayed ?

    I thought I could just put it in the page_load and not use a page.ispostback and that would mean the code is called each time the page is displayed.

    However, I have a linkbutton that modifies a customer in the database. When the user clicks the linkbutton, the customer is modified and the page is redisplayed BUT I dont see the updated information for the customer.

    (I have another page that displays a grid that shows the latest data whenever it is called).

    Should I create a function to load the customer that the page_load and linkbutton both call ?

    Source: http://community.livejournal.com/aspdotnet/94877.html

  8. Postback question

    Date: 01/28/08     Keywords: database

    How do I run a piece of code each time a page is displayed ?

    I thought I could just put it in the page_load and not use a page.ispostback and that would mean the code is called each time the page is displayed.

    However, I have a linkbutton that modifies a customer in the database. When the user clicks the linkbutton, the customer is modified and the page is redisplayed BUT I dont see the updated information for the customer.

    (I have another page that displays a grid that shows the latest data whenever it is called).

    Should I create a function to load the customer that the page_load and linkbutton both call ?

    Source: http://aspdotnet.livejournal.com/94877.html

  9. Postback question

    Date: 01/28/08     Keywords: database

    How do I run a piece of code each time a page is displayed ?

    I thought I could just put it in the page_load and not use a page.ispostback and that would mean the code is called each time the page is displayed.

    However, I have a linkbutton that modifies a customer in the database. When the user clicks the linkbutton, the customer is modified and the page is redisplayed BUT I dont see the updated information for the customer.

    (I have another page that displays a grid that shows the latest data whenever it is called).

    Should I create a function to load the customer that the page_load and linkbutton both call ?

    Source: https://aspdotnet.livejournal.com/94877.html

  10. passing dataset to webusercontrol

    Date: 01/23/08     Keywords: web

    I have a webusercontrol with a repeater on it.

    I'd like to pass a dataset to the webusercontrol and then have the usercontrol bind the dataset to the repeater.

    Should I do this using the set method ?

    EG:
    public DataSet SearchResults
    {
    set { //bind the dataset here
    SearchResultsRepeater.DataSource = SearchResults;
    SearchResultsRepeater.DataBind();
    }
    }

    Source: http://community.livejournal.com/aspdotnet/94669.html

  11. Dynamic SQL vs SP

    Date: 01/21/08     Keywords: database, sql

    My users need to search a database using an "advanced search" feature.

    The advanced search feature has a number of parameters that the user can specify or not specify depending on their needs.

    EG search by company name, city, state or search by company name & state or search by city & state

    So some of the possible parameters could be blank.

    In that case, am I better using dynamic SQL rather than a stored procedure ?

    I know stored procedures run faster than dynamic SQL but the SP to handle all the possible permutations of search criteria will make the SP very difficult to write and maintain.

    Source: http://community.livejournal.com/aspdotnet/94233.html

  12. data from more than one table

    Date: 01/04/08     Keywords: no keywords

    Can someone recommend a tutorial that explains how to get data from more than one table in a dataset ? (Assuming that's possible)

    Source: http://community.livejournal.com/aspdotnet/94181.html

  13. GridView question

    Date: 12/11/07     Keywords: asp

    I'm sure this question has been asked a thousand times so I apologize in advance.

    I have a grid with two columns. I'd like one of them to be a link which the user can click on to load more details.

    I've seen how I can use a HyperLinkField to do this but then I have to put the item ID in the URL /details.aspx?id={0} etc.

    Instead I'd like to use the SelectedIndexChanged Event. I made a version of the grid that will do what I want using a CommandField column.

    Unfortunately the CommandField column has "Select" in each row - whereas I would like the item name.

    Is there a way to do that using the CommandField column or should I use another approach ?

    Source: http://community.livejournal.com/aspdotnet/93930.html

  14. App_Code

    Date: 11/26/07     Keywords: asp, web

    Is App_Code a ASP.NET 2.0 (VS2005) or ASP.NET 3.5 (VS2008) feature? I've tried running a simple little page on my local IIS system as well as my webhost (Brinkster), and both times it tells me the class from the code in my App_Code directory is missing, and it throws this error:

    Compiler Error Message: BC30002: Type 'TestFunctions' is not defined.

    However, when I test the same page out using Cassini, it works without any problems. I apologize if this is worded awkwardly, I'm a bit new to ASP.NET 2.0/3.5 scene.

    Any help would be welcome. Thanks!

    EDIT: Hmm. Looks like the App_Code directory needs to be in your wwwroot directory for it to work.

    Source: http://community.livejournal.com/aspdotnet/93438.html

  15. Passwordrecovery control & email

    Date: 11/20/07     Keywords: web

    I am trying to send an email from tha passwordrecovery control using an email address from the web.config without any success.

    Everything compiles OK, the mail username/password are correct and it works until I get to the Submit after answering the question.

    Then I get an error - "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond "

    Below is the code I am using. Can anyone tell me what I am doing wrong ?

    Type your cut contents here.


        nathan@example.net" Subject="Password">
       

       
       

       

       
    Your password has been sent to you.


    In the web.config
     
       
          nathan@example.net">
                             password="xxxxx"
                     userName="nathan+example.net"
                     defaultCredentials="true"
                     port="110"/>
         

       

      decryptionKey="xxxxx"
      validation="SHA1"
      decryption="AES"/>

     
             name="CustomizedMembershipProvider"
           type="System.Web.Security.SqlMembershipProvider"
           enablePasswordRetrieval="true"
           enablePasswordReset="false"
           requiresQuestionAndAnswer="true"
           requiresUniqueEmail="true"
           passwordFormat="Encrypted"
           maxInvalidPasswordAttempts="5"
           passwordAttemptWindow="30"
           passwordStrengthRegularExpression=""
           minRequiredPasswordLength="7"
           minRequiredNonalphanumericCharacters="0"/>
         




    Source: http://community.livejournal.com/aspdotnet/93015.html

  16. Public & private info on the same page

    Date: 11/09/07     Keywords: no keywords

    I am working on a site that uses forms authentication.

    I would like a page where some of the information is available to anyone and some of it is only available to logged in users.

    Is that possible ? (And can you give me any clues as to how I would do it ?)

    Source: http://community.livejournal.com/aspdotnet/92551.html

  17. Wierd error

    Date: 09/15/07     Keywords: database, sql, microsoft

    I inherited a program that takes data from a csv file and inserts it into a database.

    The data is in the following format:

    8/20/2007 12:14:21 PM,HDFM,"Nick Yockell","Nate Wittrock",239-850-3931,239-850-2514,"Used 2004 Harley Davidson ","bought bike
    CUSTOMER WANTS TO BRING HIS YAMAHA R6 IN TO TRADE AND SEE HOW MUCH PAYMENTS WOULD BE.
    ",Deliver,aa32ed31-f0c8-4f43-a7d4-830d9f29edcd


    For some reason the function that saves the data to the database is having a problem with the customer phone number (5th column).

    The database column is a varchar(50) - the same as the customer business phone number.

    If the customer home phone contains anything other that digits it cannot be saved to the database.

    However, the customer business phone can contain anything and gets saved just fine.

    The sql statement in the second function runs fine from query analyzer so I know thats not the problem.

    Is there anything in the two functions that could be causing this ?



    private void ProcessFile(string filename, string vendor)
    {


    string path = string.Empty;
    string LoggingDate = DateTime.Now.ToString();

    switch (vendor.ToLower())
    {
    case "vpulse":
    path = DIRECTORYPATHVPULSE;
    break;
    case "calllogpro":
    path = DIRECTORYPATHCALLLOGPRO;
    break;

    }

    try
    {
    OleDbConnection ExcelConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path+"\\"+";Extended Properties=\"Text;HDR=No;FMT=Delimited()\"");
    //OleDbConnection ExcelConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+this.txtSource.Text+"\\"+";Extended Properties=\"Text;HDR=No;\"");
    OleDbCommand ExcelCommand = new OleDbCommand(@"SELECT * FROM "+filename,ExcelConnection);

    OleDbDataAdapter ExcelAdapter = new OleDbDataAdapter(ExcelCommand);

    ExcelConnection.Open();

    DataSet ExcelDataSet = new DataSet();
    ExcelAdapter.Fill(ExcelDataSet);

    ExcelConnection.Close();

    //Process File
    ProcessFileRecords(ExcelDataSet, vendor.ToLower());

    //Email Copy to Alliance Group
    this.EmailFile(path, filename, vendor);



    }
    catch (Exception exc)
    {
    string errorText = exc.ToString();
    System.Diagnostics.EventLog.WriteEntry("Alliance Level 2 DataRetreiver", errorText);

    }
    finally
    {
    //Archive Copy
    this.ArchiveFile(path, filename);
    }
    }




    private void ProcessFileRecordVPulse(object[] record)
    {
    string logdate = string.Empty;
    string dealership = string.Empty;
    string salesperson = string.Empty;
    string customername = string.Empty;
    string homephone = string.Empty;
    string businessphone = string.Empty;
    string product = string.Empty;
    string comments = string.Empty;
    string sellstage = string.Empty;
    string vpulsecalltaskid = string.Empty;

    string LoggingDate = DateTime.Now.ToString();

    try
    {
    logdate = Convert.ToDateTime(record[0]).ToShortDateString();
    dealership = record[1].ToString();
    salesperson = record[2].ToString();
    customername = record[3].ToString();

    try
    {
    homephone = record[4].ToString();
    //homephone.Replace("-", "");
    }
    catch
    {
    homephone = "Bad format";
    }

    businessphone = record[5].ToString();
    product = record[6].ToString();
    comments = record[7].ToString().Replace("
    ", " ");

    //***Get Sales Stage
    sellstage = record[8].ToString();
    switch(sellstage.ToLower())
    {
    case "greet":
    sellstage = "1";
    break;
    case "probe":
    sellstage = "2";
    break;
    case "identify machine":
    sellstage = "3";
    break;
    case "presentation":
    sellstage = "4";
    break;
    case "sit down":
    sellstage = "5";
    break;
    case "write up":
    sellstage = "6";
    break;
    case "close the deal":
    sellstage = "7";
    break;
    case "finance":
    sellstage = "8";
    break;
    case "deliver":
    sellstage = "9";
    break;
    default:
    if (sellstage.ToLower().IndexOf("service") == -1 && sellstage.ToLower().IndexOf("parts") == -1)
    sellstage = "1";
    else
    sellstage = sellstage;
    break;
    }
    //***Get Sales Stage

    vpulsecalltaskid = record[9].ToString();

    //Import lead record
    SqlCommand command = this.GetCommand();

    command.CommandText = @"INSERT INTO CallLogs
    (LogDate,
    VPulseCallTaskId,
    CallLogTypeId,
    DealerId,
    SalesPerson,
    CustomerName,
    CustomerHomePhone,
    CustomerBusinessPhone,
    Product,
    Comments,
    SaleStage,
    LogProcessFlag,
    CSI14Days,
    CSI17Months,
    CSI14DaysProcessFlag,
    CSI17MonthsProcessFlag)
    VALUES
    (@LogDate,
    @VPulseCallTaskId,
    @CallLogTypeId,
    @DealerId,
    @SalesPerson,
    @CustomerName,
    @CustomerHomePhone,
    @CustomerBusinessPhone,
    @Product,
    @Comments,
    @SaleStage,
    @LogProcessFlag,
    @CSI14Days,
    @CSI17Months,
    @CSI14DaysProcessFlag,
    @CSI17MonthsProcessFlag)";

    command.Parameters.Add("@LogDate", logdate);
    command.Parameters.Add("@VPulseCallTaskId", vpulsecalltaskid);
    if ((sellstage.ToLower().IndexOf("service") == -1)&&(sellstage.ToLower().IndexOf("parts") == -1))
    {
    command.Parameters.Add("@CallLogTypeId", "1");
    }
    else
    {
    if (sellstage.ToLower().IndexOf("service") != -1)
    {
    command.Parameters.Add("@CallLogTypeId", "1"); //Service (4)
    dealership = dealership+"_SERVICE";
    sellstage = "1";
    }
    else if (sellstage.ToLower().IndexOf("parts") != -1)
    {
    command.Parameters.Add("@CallLogTypeId", "1"); //Parts (3)
    dealership = dealership+"_PARTS";
    sellstage = "1";
    }
    }
    command.Parameters.Add("@DealerId", dealership);
    command.Parameters.Add("@SalesPerson", salesperson);
    command.Parameters.Add("@CustomerName", customername);
    command.Parameters.Add("@CustomerHomePhone", homephone);
    command.Parameters.Add("@CustomerBusinessPhone", businessphone);
    command.Parameters.Add("@Product", product);
    command.Parameters.Add("@Comments", comments);
    command.Parameters.Add("@SaleStage", sellstage);
    command.Parameters.Add("@LogProcessFlag", false);
    command.Parameters.Add("@CSI14Days", Convert.ToDateTime(logdate).AddDays(14).ToString());
    command.Parameters.Add("@CSI17Months", Convert.ToDateTime(logdate).AddMonths(17).ToString());
    command.Parameters.Add("@CSI14DaysProcessFlag", false);
    command.Parameters.Add("@CSI17MonthsProcessFlag", false);

    command.ExecuteNonQuery();
    this.DisposeCommand(command);
    }

    catch (Exception exc)
    {

    string errorText = exc.ToString();
    System.Diagnostics.EventLog.WriteEntry("Alliance Level 2 DataRetreiver", errorText);

    }

    Source: http://community.livejournal.com/aspdotnet/92096.html

  18. Using DotNetBar

    Date: 07/23/07     Keywords: web

    Hi everybody!
    I really need to develop win- and web- applications look-n-feel Office 2007. And at first I decide to use DotNetBar controls, but as I know, that don't support web-application developing?! If it's truth, can you are give me advice about what kind of controls I can use for achieve my aims? Thanx!

    Source: http://community.livejournal.com/aspdotnet/91419.html

  19. Loading ASPX without a browser

    Date: 07/10/07     Keywords: browser, html, asp, web

    Ok, this is going to sound really weird, and it's kind of hard to explain, but is there a way to take an ASPX file, and load its contents, allowing you to use code behind, without a browser?

    Basically here is what I need to do:

    I have an AJAX enabled web page, and I need to be able to use a lot of the AJAX enabled controls like the CollapsiblePanelExtender. The thing is, speed of loading the page is paramount, and even though the final data isn't that much, the business code to massage the data is huge and actually time consuming. What I need to be able to do, is on a daily basis, have a service that generates the page, and then stores the page, with the massaged data, to the DB. Then what happens is when the "page" itself is called by a user, it goes to the DB and gets my "aspx" code, and sends that down. It can't be generated HTML. Not going to get in to "why" here.

    Basically the "aspx" page would have asp controls on it like labels, but the text itself is already saved, and there is no need for code behind to generate the data.

    It's kind of like a template in that I'd have an ASPX page that is my "template" The service would then load the page as if it was in a browser, and it would go through and set the "Text" values on the Labels, text boxes, etc. etc. based on the data from the DB, but then instead of saving the generated HTML, it would just modify the ASPX itself, and I could then save that ASPX code to the DB.

    Currently what I do is create an ASPX page, and then rename it to a text file. The labels don't have any IDs or anything, and then I just go through and replace everything as text.

    I know there has to be a better way to do this. Any ideas?

    Source: http://community.livejournal.com/aspdotnet/90433.html

  20. Applications in IIS

    Date: 06/08/07     Keywords: no keywords

    is there a way to make a subdirectory an application in IIS through Visual Studio? In other words, making a subdirectory into an application without having access to IIS?

    Source: http://community.livejournal.com/aspdotnet/89905.html

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home