Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. URI Format Not Supported. [modified]

URI Format Not Supported. [modified]

Scheduled Pinned Locked Moved ASP.NET
csharpsysadminhtmlwcfhelp
20 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Meetu Choudhary
    wrote on last edited by
    #1

    I am Sending a Mail with attachemts for this I have Made A WCF Which works fine when I give the Network path of the file. but I need to host It And when I try to give a URL path It Says. URI format not supported please Help My Code in WCF public List funSendMail(Mailcls m) { List result = new List(); try { /* Create a new blank MailMessage with the from and to adreesses*/ System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(m.Sender, m.Receiver); /*Checking the condition that the cc is empty or not if not then * include them */ if (m.Cc != null && m.Cc != string.Empty) { mailMessage.CC.Add(m.Cc); } /*Checking the condition that the Bcc is empty or not if not then * include them */ if (m.Bcc != null && m.Bcc != string.Empty) { mailMessage.Bcc.Add(m.Bcc); } //Ading Subject to the Mail mailMessage.Subject = m.Subject; //Adding the Mail Body mailMessage.Body = m.Body; /* Set the properties of the MailMessage to the values on the form as per the mail is HTML formatted */ mailMessage.IsBodyHtml = true; /* Bigining of Attachment1 process & Check the all file for a attachment */ if ((m.AttachfilesPath != null) && (m.AttachfilesPath.Count > 0)) { foreach (string s in m.AttachfilesPath) { result.Add("Attaching File : " + s); System.Net.Mail.Attachment attach = new System.Net.Mail.Attachment(s); /* Attach the newly created email attachment */ mailMessage.Attachments.Add(attach); } } /* Set the SMTP server and send the email with attachment */ System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(); // smtpClient.Host = emailServerInfo.MailServerIP; //this will be the host in case of gamil and it varies from the service provider

    C V 2 Replies Last reply
    0
    • M Meetu Choudhary

      I am Sending a Mail with attachemts for this I have Made A WCF Which works fine when I give the Network path of the file. but I need to host It And when I try to give a URL path It Says. URI format not supported please Help My Code in WCF public List funSendMail(Mailcls m) { List result = new List(); try { /* Create a new blank MailMessage with the from and to adreesses*/ System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(m.Sender, m.Receiver); /*Checking the condition that the cc is empty or not if not then * include them */ if (m.Cc != null && m.Cc != string.Empty) { mailMessage.CC.Add(m.Cc); } /*Checking the condition that the Bcc is empty or not if not then * include them */ if (m.Bcc != null && m.Bcc != string.Empty) { mailMessage.Bcc.Add(m.Bcc); } //Ading Subject to the Mail mailMessage.Subject = m.Subject; //Adding the Mail Body mailMessage.Body = m.Body; /* Set the properties of the MailMessage to the values on the form as per the mail is HTML formatted */ mailMessage.IsBodyHtml = true; /* Bigining of Attachment1 process & Check the all file for a attachment */ if ((m.AttachfilesPath != null) && (m.AttachfilesPath.Count > 0)) { foreach (string s in m.AttachfilesPath) { result.Add("Attaching File : " + s); System.Net.Mail.Attachment attach = new System.Net.Mail.Attachment(s); /* Attach the newly created email attachment */ mailMessage.Attachments.Add(attach); } } /* Set the SMTP server and send the email with attachment */ System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(); // smtpClient.Host = emailServerInfo.MailServerIP; //this will be the host in case of gamil and it varies from the service provider

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Might adding http:// cause it to know it's a web address ? ( this has nothing to do wtih ASP.NET, btw )

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      M 1 Reply Last reply
      0
      • C Christian Graus

        Might adding http:// cause it to know it's a web address ? ( this has nothing to do wtih ASP.NET, btw )

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        M Offline
        M Offline
        Meetu Choudhary
        wrote on last edited by
        #3

        I tried It That way too. If I add Http:// The it says URI format not supported and if i remove that then it says path not found as it adds the extra path thill bin dir to the actula path

        Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

        C 1 Reply Last reply
        0
        • M Meetu Choudhary

          I tried It That way too. If I add Http:// The it says URI format not supported and if i remove that then it says path not found as it adds the extra path thill bin dir to the actula path

          Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Looking at your code a bit more, I am not surprised. You're asking the mail code to do a HTTP transfer on your behalf, but I doubt that is supported. So, the error is correct. Why do you want to mail an image from a hard coded URL ? Why not make that image a local file ?

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          M 1 Reply Last reply
          0
          • C Christian Graus

            Looking at your code a bit more, I am not surprised. You're asking the mail code to do a HTTP transfer on your behalf, but I doubt that is supported. So, the error is correct. Why do you want to mail an image from a hard coded URL ? Why not make that image a local file ?

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            M Offline
            M Offline
            Meetu Choudhary
            wrote on last edited by
            #5

            See That Image is a local file but Silverlight or WCf service can't access the local path of the client system. so i uploaded that on my server using a WCF for upload files. now attaching it to the mail. as silverlight has its contrains...

            Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

            C 1 Reply Last reply
            0
            • M Meetu Choudhary

              See That Image is a local file but Silverlight or WCf service can't access the local path of the client system. so i uploaded that on my server using a WCF for upload files. now attaching it to the mail. as silverlight has its contrains...

              Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Well, I would imagine if there's a solution, it involves doing a HTTP request to get the file bytes, I know silverlight gives you a sandbox you could use to save the file, and then send it from there.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              M 1 Reply Last reply
              0
              • C Christian Graus

                Well, I would imagine if there's a solution, it involves doing a HTTP request to get the file bytes, I know silverlight gives you a sandbox you could use to save the file, and then send it from there.

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                M Offline
                M Offline
                Meetu Choudhary
                wrote on last edited by
                #7

                If you knw that then plz do let me knw too as i googled and binged a lot on that and final solution is to use a webservice or wcf. so we are using wcf. I am egarly waiting to know the solution.

                Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                C 1 Reply Last reply
                0
                • M Meetu Choudhary

                  If you knw that then plz do let me knw too as i googled and binged a lot on that and final solution is to use a webservice or wcf. so we are using wcf. I am egarly waiting to know the solution.

                  Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  I have no idea, I know that expecting email code to take a URL as an attachment is not going to work, and I know you're still asking in the wrong forum. Perhaps someone in the right forum, will know enough to help you.

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  M 1 Reply Last reply
                  0
                  • C Christian Graus

                    I have no idea, I know that expecting email code to take a URL as an attachment is not going to work, and I know you're still asking in the wrong forum. Perhaps someone in the right forum, will know enough to help you.

                    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                    M Offline
                    M Offline
                    Meetu Choudhary
                    wrote on last edited by
                    #9

                    can you please tell me in which fourm to ask this. I have posted it in silverlight, wcf and web devlopment too.

                    Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                    C 1 Reply Last reply
                    0
                    • M Meetu Choudhary

                      can you please tell me in which fourm to ask this. I have posted it in silverlight, wcf and web devlopment too.

                      Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      Well, spamming the whole site is just rude. Silverlight is the right forum. As I said in the outset, this has nothing to do with ASP.NET. The silverlight forum might be a little slower, you might wait a bit longer for a reply.

                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                      M 1 Reply Last reply
                      0
                      • C Christian Graus

                        Well, spamming the whole site is just rude. Silverlight is the right forum. As I said in the outset, this has nothing to do with ASP.NET. The silverlight forum might be a little slower, you might wait a bit longer for a reply.

                        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                        M Offline
                        M Offline
                        Meetu Choudhary
                        wrote on last edited by
                        #11

                        That's Why I tried Here Any Ways. I didn't wanted to spam the site. I will try to remove my posts. Thanks for the Help.

                        Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                        1 Reply Last reply
                        0
                        • M Meetu Choudhary

                          I am Sending a Mail with attachemts for this I have Made A WCF Which works fine when I give the Network path of the file. but I need to host It And when I try to give a URL path It Says. URI format not supported please Help My Code in WCF public List funSendMail(Mailcls m) { List result = new List(); try { /* Create a new blank MailMessage with the from and to adreesses*/ System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(m.Sender, m.Receiver); /*Checking the condition that the cc is empty or not if not then * include them */ if (m.Cc != null && m.Cc != string.Empty) { mailMessage.CC.Add(m.Cc); } /*Checking the condition that the Bcc is empty or not if not then * include them */ if (m.Bcc != null && m.Bcc != string.Empty) { mailMessage.Bcc.Add(m.Bcc); } //Ading Subject to the Mail mailMessage.Subject = m.Subject; //Adding the Mail Body mailMessage.Body = m.Body; /* Set the properties of the MailMessage to the values on the form as per the mail is HTML formatted */ mailMessage.IsBodyHtml = true; /* Bigining of Attachment1 process & Check the all file for a attachment */ if ((m.AttachfilesPath != null) && (m.AttachfilesPath.Count > 0)) { foreach (string s in m.AttachfilesPath) { result.Add("Attaching File : " + s); System.Net.Mail.Attachment attach = new System.Net.Mail.Attachment(s); /* Attach the newly created email attachment */ mailMessage.Attachments.Add(attach); } } /* Set the SMTP server and send the email with attachment */ System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(); // smtpClient.Host = emailServerInfo.MailServerIP; //this will be the host in case of gamil and it varies from the service provider

                          V Offline
                          V Offline
                          vishwjeet
                          wrote on last edited by
                          #12

                          Hi, Have you tried this .. this is not my code .. I got it from net... Dim client As New WebClient Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz" Dim strFilename As String = Server.MapPath("myfile.gz") client.DownloadFile(strURL, strFilename)

                          M 1 Reply Last reply
                          0
                          • V vishwjeet

                            Hi, Have you tried this .. this is not my code .. I got it from net... Dim client As New WebClient Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz" Dim strFilename As String = Server.MapPath("myfile.gz") client.DownloadFile(strURL, strFilename)

                            M Offline
                            M Offline
                            Meetu Choudhary
                            wrote on last edited by
                            #13

                            Server.Mappath is not supported in WCF

                            Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                            V 1 Reply Last reply
                            0
                            • M Meetu Choudhary

                              Server.Mappath is not supported in WCF

                              Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                              V Offline
                              V Offline
                              vishwjeet
                              wrote on last edited by
                              #14

                              server.mappath is being used to generate a local path(local to the server) .. u can use absolute path.

                              M 1 Reply Last reply
                              0
                              • V vishwjeet

                                server.mappath is being used to generate a local path(local to the server) .. u can use absolute path.

                                M Offline
                                M Offline
                                Meetu Choudhary
                                wrote on last edited by
                                #15

                                sorry I didn't Get What You want to conevy. can you please explain with an example?

                                Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                                V 1 Reply Last reply
                                0
                                • M Meetu Choudhary

                                  sorry I didn't Get What You want to conevy. can you please explain with an example?

                                  Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                                  V Offline
                                  V Offline
                                  vishwjeet
                                  wrote on last edited by
                                  #16

                                  Dim client As New WebClient Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz" //Dim strFilename As String = Server.MapPath("myfile.gz") Dim strFilename As String = "c:\inetpub\wwwroot\my_app\images\myfile.gz" client.DownloadFile(strURL, strFilename) i wanted to suggested this workaround .. as server.mappath is not working.

                                  M 1 Reply Last reply
                                  0
                                  • V vishwjeet

                                    Dim client As New WebClient Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz" //Dim strFilename As String = Server.MapPath("myfile.gz") Dim strFilename As String = "c:\inetpub\wwwroot\my_app\images\myfile.gz" client.DownloadFile(strURL, strFilename) i wanted to suggested this workaround .. as server.mappath is not working.

                                    M Offline
                                    M Offline
                                    Meetu Choudhary
                                    wrote on last edited by
                                    #17

                                    and what will happen if I upload the web and then i would not be knowing what is the physical path I don't want a tempory solution. It should be ready to launch solution

                                    Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                                    V 1 Reply Last reply
                                    0
                                    • M Meetu Choudhary

                                      and what will happen if I upload the web and then i would not be knowing what is the physical path I don't want a tempory solution. It should be ready to launch solution

                                      Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                                      V Offline
                                      V Offline
                                      vishwjeet
                                      wrote on last edited by
                                      #18

                                      Well.. im not aware of what wcf supports .. but there must be some way to find the current directory's path

                                      M 1 Reply Last reply
                                      0
                                      • V vishwjeet

                                        Well.. im not aware of what wcf supports .. but there must be some way to find the current directory's path

                                        M Offline
                                        M Offline
                                        Meetu Choudhary
                                        wrote on last edited by
                                        #19

                                        May Be But I am not able to serch it till now.

                                        Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                                        M 1 Reply Last reply
                                        0
                                        • M Meetu Choudhary

                                          May Be But I am not able to serch it till now.

                                          Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                                          M Offline
                                          M Offline
                                          Meetu Choudhary
                                          wrote on last edited by
                                          #20

                                          Fine I got The Answer The Solution Is Here

                                          Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums

                                          modified on Friday, September 11, 2009 9:27 AM

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups