.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

attachment in mail not working on webserver

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net
 

hi everybody i am using the mail sending facilily in asp.net using system.net.mail and system.net.mime.my code is work fine on local host but show the followiing error on webserver as exception

System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\vhosts\dakshtechnology.com\httpdocs\Sec-77 Price List....doc' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at System.Web.HttpPostedFile.SaveAs(String filename) at Recruitment.btnsubmit_Click(Object sender, EventArgs e) in c:\inetpub\vhosts\dakshtechnology.com\httpdocs\Recruitment.aspx.cs:line 83


 i am using the following code

            if (fleupload.PostedFile != null)
            {
                HttpPostedFile attfile = fleupload.PostedFile;
                int attachfilelength = attfile.ContentLength;
                if (attachfilelength > 0)
                {
                    string attachfilename = Path.GetFileName(fleupload.PostedFile.FileName);
                    fleupl


View Complete Post


More Related Resource Links

Send E-mail with attachment with workflow

  
I use workflow in custom list. When new item is created and have attachment. An e-mail is send with attachment. I can not add attachment, or I don’t know how to do that with lookup. I can add link with ID of newly created item, which is ok. But I would like to add attachment directly…Borut

Database Mail configuring the maximum mail size (not attachment 'MaxFileSize')

  
Hi can anyone tell me if it's possible to configure the maximum size of an email when using database mail?  I know it's possible to use sysmail_configure_sp to set 'MaxFileSize', I want to prevent an email being sent the size of the body of the email is very large. In my case the body is based on a query result set inserted as html. Thanks      

Incoming E-Mail with attachment not starting SharePoint workflow (VS 2008)

  
I am working on SharePoint 2007 workflow in visual studio 2008. The workflow is attached to an email-enabled list and is supposed to automatically start on incoming email. It works fine when email (without attachment) is sent to the list but the workflow cannot start when the email is sent with attachment. There is no error message but the workflow status field is blank. The attachment field is also blank. When I manually run the workflow, it works fine. This problem happened on Staging and production servers. On Development server, the workflow works fine either way. The list is setup to save attachments. Any help please

Incoming E-Mail with attachment not starting SharePoint workflow (VS 2008)

  
I am working on SharePoint 2007 workflow in visual studio 2008. The workflow is attached to an email-enabled list and is supposed to automatically start on incoming email. It works fine when email (without attachment) is sent to the list but the workflow cannot start when the email is sent with attachment. There is no error message but the workflow status field is blank. The attachment field is also blank. When I manually run the workflow, it works fine. This problem happened on Staging and production servers. On Development server, the workflow works fine either way. The list is setup to save attachments. Any help please

Ldap authenication code is not working with IIS but works with Visual Studio developement webserver

  
Hi,I have weird issue here, I have a method that  takes a login Id and authenticates with LDAP active directory and returns the employee Id.It works great when I run the application in Visual studio 2008 ( it uses the default visual studio developement webserver). The code authenitcates the login id and returns emp Id perfectly. But the problem comes when I publish the code to the Local IIS in my developement PC.public string GetEastWestTeamMembersEmployeeID(string loginID)        {            string domain = string.Empty;            string login = string.Empty;            int position = loginID.IndexOf(@"\");            string empid = "";                  System.DirectoryServices.DirectoryEntry directoryEntry = null;            if (position >= 0)            {                domain = loginID.Substring(0, position);    &n

WordAutomation - Not working when published to IIS Webserver

  
Hi, I am bulding a site that will create word documents from templates and fill in the bookmarks.  Its working fine when running locally in VS but when I publish to the webserver it seems to have an issue opening word.   Durning testing I created a new site that only has the code below and its still not working - you click on a button and it looks to have worked but word never opens.  I have done 2 days of fault finding to no avail.  The server has office 2003 installed and I have put the correct dlls in the bin folder of the project and still no joy - I have played around with as many settings as I can in IIS and still nothing.  Any Ideas???Thanks  object oMissing = System.Reflection.Missing.Value; object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */ //Start Word and create a new document. Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);   I am using; using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Microsoft.Office;using Word = Microsoft

Moving To a new Webserver page stopped working - BC30561: 'TreeNode' is ambiguous

  

Hi

Since i migrated a page to a new webserver running Asp v4 the page throws up this error I'm guessing ASPv4 it doesn't like the asp.2 code not having much of a clue of ASP I need some help to figure out how to resolve this problem. thanks in advance

D.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30561: 'TreeNode' is ambiguous, imported from the namespaces or types 'System.Web.UI.WebControls, Microsoft.Web.UI.WebControls'.

Private Sub populateTreeView(ByVal strDirectory As String, ByVal nodeParent As TreeNode)
Line 58:             Try
Line 59:                 Dim CurDir As New DirectoryInfo(strDirectory)

Customized form not working with attachment

  
I created a customized edit form using the "Custom List Form" in SharePoint Designer.  Now the attach file button no longer works.  I am getting "This form was customized not working with attachment."  Has anyone found a workaround for this?

mail attachment Handler call

  

Hi friends,

I am new in javascript  using call handler(ashx). My problem is i have a html form contains some text box and one attachment(using <input type="file">) option. after enter all data i call handler. Here handler get all values with attachment and send a mail. i will not able to attach that attachment path any other option mail send with attachment using handler.


Thanks

Vendan


How to embed CSS link with attachment when using System.Net.Mail

  
Dear All

I can use the embed image show in the mail client, but I cannot do the same with CSS.

Please help.

Following is my code

            string fromAddress = "noreply@test.com";
            string toAddress = "myemail@test.com";
            MailMessage mailMessage = new MailMessage(fromAddress, toAddress);
            mailMessage.Subject = "Test";

            LinkedResource logo = new LinkedResource("Logo.jpg");           
            logo.ContentId = "companylogo";
            LinkedResource css = new LinkedResource("default.css");
            css.ContentId = "defaultCSS";

            AlternateView av1 = AlternateView.CreateAlternateViewFromString(@"
  <html>            
            <link href='cid:defaultCSS' rel='stylesheet' type='text/css'/>
            <basefont face='Verdana' size='2'/>
   <body>
    <table width='75%' align='center'>
     <tr>
      <td style='height: 21px'>
  <p><strong>
   This test
  </strong></p>
            <img src='cid:companylogo'/>
      </td>

Working with SharePoint document libraries

  
Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.

Working with DropDownList and ListBox Controls in ASP.NET

  
"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

Server side validation of Fileupload control not working

  
 

 


I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.


Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
       

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
        Else
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

Row command working on all rows not selected one?

  

Hi,

I have this code that hides a column in a gridview.  (The column houses another nested gridview).


    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        If e.CommandName = "Select" Then
            If GridView1.Columns(0).Visible = False Then
                GridView1.Columns(0).Visible = True
            Else
                GridView1.Columns(0).Visible = False
            End If
        End If
    End Sub


The trouble is that if I click the select link on one row that action to hide is carried out on all rows.  How can I set this up so that it only hides the row that is selected?


Thanks.


upload file not working

  

Hi,

iam using masterpage and ajax update panel, i have child page called  fileupload.aspx,i try to upload the file

but its not working , can i use updatepanel in child page , pls very urgent

looking forward for answer.




JQuery Treeview plugin is not working with Ajax page load in ie8

  

Hi there,

I developed a page where i m using jquery treeview plugin to generate tree. It worked fine on FF, IE8 with out ajax.

But when my page loads thro' ajax call in IE8, it is not collapsing or expanding tree.


Any idea?

Thanks in advance.



jquery confirm windows isn't working

  

Hi, i am using jquery to implement a modal confirm windows but it not working

i have a template field button with ajax confirm using jquery but i have a problem. Apper the confirm windows but when i click on "yes" doesn't execute the delete command. without ajax (using template field button and simple confirm windows javascript) works so well.

Can you give me a hand with this?

thx in advance!


<link href="_assets/css/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="_assets/css/confirm.css" rel="stylesheet" type="text/css" />
<script src="_assets/js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="_assets/js/jquery.simplemodal-1.1.1.js" type="text/javascript"></script>

<script type="text/javascript">
  
$(document).ready(function() {
       $("#msg").text('');
       $(".deleteCustomer").click(function(ev) {
                ev.preventDefault();
                var msg = $(this).attr("title");
                $("#HiddenFieldRowId").val($(this).parent("tr").find(".id").val());
                confirm(msg + "?");
        });
})
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend