﻿
{"id":2979,"date":"2014-08-10T17:05:06","date_gmt":"2014-08-10T17:05:06","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=2979"},"modified":"2014-08-10T17:05:06","modified_gmt":"2014-08-10T17:05:06","slug":"the-saveas-method-is-configured-to-require-a-rooted-path-and-the-path-is-not-rooted-hatasi-ve-cozumu","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/the-saveas-method-is-configured-to-require-a-rooted-path-and-the-path-is-not-rooted-hatasi-ve-cozumu\/","title":{"rendered":"&#8220;The SaveAs Method \u0130s Configured To Require A Rooted Path, And The Path &#8216;&#8230;&#8217; \u0130s Not Rooted&#8221; Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Web yaz\u0131l\u0131mlar\u0131nda site \u00fczerinden FTP&#8217;ye, Server&#8217;a ya da Hosting&#8217;e(hepside ayn\u0131 kap\u0131ya \u00e7\u0131kar) dosya y\u00fckleme i\u015fleminde<\/p>\n<p style=\"text-align: center;\">&#8220;<span style=\"color: #ff0000;\">The SaveAs method is configured to require a rooted path, and the path &#8216;..&#8217; is not rooted.<\/span>&#8220;<\/p>\n<p>hatas\u0131 al\u0131yorsan\u0131z e\u011fer mant\u0131ksal olarak yapt\u0131\u011f\u0131n\u0131z hatan\u0131n fark\u0131nda de\u011filsiniz demektir.Asl\u0131nda al\u0131nan bu hata teknik olarak mant\u0131ksal de\u011fil, fiziksel bir yap\u0131ya sahiptir.<br \/>\nMevzuya girmeden \u00f6nce hatan\u0131n g\u00f6rsel halinide a\u015fa\u011f\u0131da payla\u015fmakta fayda var.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2014\/08\/HttpException.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2982\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2014\/08\/HttpException.png\" alt=\"HttpException\" width=\"446\" height=\"226\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2014\/08\/HttpException.png 446w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2014\/08\/HttpException-300x152.png 300w\" sizes=\"auto, (max-width: 446px) 100vw, 446px\" \/><\/a><br \/>\nHatay\u0131 netle\u015ftirebilmek i\u00e7in bir site \u00fczerinden Hosting&#8217;e resim y\u00fcklendi\u011fini varsayal\u0131m.<br \/>\n\u00dc\u00e7 a\u015fa\u011f\u0131 be\u015f yukar\u0131 kodlar\u0131n\u0131z a\u015fa\u011f\u0131daki gibi olacakt\u0131r.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n.\r\n.\r\n.\r\n                FileUpload.SaveAs(&quot;~\/Content\/Resimler\/&quot;+ DosyaAdi);\r\n.\r\n.\r\n.\r\n<\/pre>\n<p>Bu tarz bir kodda bizim a\u00e7\u0131m\u0131zdan mant\u0131ksal, mimarisel a\u00e7\u0131dan fiziksel olan hataya de\u011finirsek e\u011fer, dosyan\u0131n kaydedilece\u011fi uzant\u0131n\u0131n yolunu tam olarak vermememizden kaynaklanmaktad\u0131r.Yaz\u0131l\u0131m bu dosyay\u0131 kaydetmek i\u00e7in verilen dizini arayacak ama &#8220;Content&#8221; isimli k\u00f6k bir klas\u00f6r bulamayaca\u011f\u0131 i\u00e7in hata verecektir.<\/p>\n<p>Bizim burada yapmam\u0131z gereken Server&#8217;a at\u0131lacak olan dosyan\u0131n, gidece\u011fi dizinin fiziksel adresini tam olarak vermektir.Biz her Server&#8217;\u0131n fiziksel yol uzant\u0131s\u0131n\u0131 net bilemeyece\u011fimiz i\u00e7in mimarinin bizlere sundu\u011fu &#8220;Server&#8221; s\u0131n\u0131f\u0131ndan yararlanabiliriz.K\u00f6keni Asp diline dayanan bu s\u0131n\u0131f, Asp.NET mimarisine de ge\u00e7i\u015f yapm\u0131\u015ft\u0131r.<\/p>\n<p>Mimarinin bizlere sundu\u011fu &#8220;Server&#8221; s\u0131n\u0131f\u0131 sayesinde biz web yaz\u0131l\u0131m\u0131m\u0131z\u0131n \u00e7al\u0131\u015faca\u011f\u0131 Server&#8217;da rahat\u00e7a i\u015flem yapabiliriz.&#8221;Server&#8221; s\u0131n\u0131f\u0131nda bulunan &#8220;MapPath(Yol Belirleme)&#8221; metodu ile web sitemizin \u00e7al\u0131\u015ft\u0131\u011f\u0131 Server&#8217;da ki yollar\u0131m\u0131z\u0131 kesin olarak belirleyebilece\u011fimiz i\u00e7in Server&#8217;\u0131n bu yolu hangi k\u00f6k dizinde tuttu\u011fuyla ilginenmemize gerek kalmayacakt\u0131r.\u0130ster &#8220;C:\/\/A\/B\/C\/&#8230;\/Content\/Resimler\/&#8221; dizinine benzer bir yol olsun, isterse de &#8220;H:\/\/Ahmet\/Mehemt\/Necati\/&#8230;\/Content\/Resimler\/&#8221; dizinine benzer yol olsun uygun dizinlerde \u00e7al\u0131\u015fmak i\u00e7in onca zahmetten kurtarmaktad\u0131r.<\/p>\n<p>&#8220;Server&#8221; s\u0131n\u0131f\u0131ndaki &#8220;MapPath&#8221; metodunun kullan\u0131m \u015fekli a\u015fa\u011f\u0131daki prototipten g\u00f6rebilirsiniz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nServer.MapPath(&quot;&quot;)\r\n<\/pre>\n<p>\u015eimdi yukar\u0131daki kod blo\u011funa benzer kodunuzu a\u015fa\u011f\u0131dakine benzer bir bi\u00e7imde d\u00fczenleyiniz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n.\r\n.\r\n.\r\n                FileUpload.SaveAs(Server.MapPath(&quot;~\/Content\/Resimler\/&quot;+ DosyaAdi));\r\n.\r\n.\r\n.\r\n<\/pre>\n<p>Evet bu \u015fekilde k\u00fc\u00e7\u00fck bir d\u00fczenlemeyle bu hatadan kurtulmu\u015f oluyoruz. \ud83d\ude42<\/p>\n<p>\u0130yi \u00e7al\u0131\u015fmalar dilerim&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Web yaz\u0131l\u0131mlar\u0131nda site \u00fczerinden FTP&#8217;ye, Server&#8217;a ya da Hosting&#8217;e(hepside ayn\u0131 kap\u0131ya \u00e7\u0131kar) dosya y\u00fckleme i\u015fleminde &#8220;The SaveAs method is configured to require a rooted path, and the path &#8216;..&#8217; is not rooted.&#8220; hatas\u0131 al\u0131yorsan\u0131z&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,11,600],"tags":[260,484,667,493,666],"class_list":["post-2979","post","type-post","status-publish","format-standard","hentry","category-asp-net","category-asp-net-mvc","category-asp-net-mvc-5","tag-hata","tag-hata-cozumu","tag-mappath","tag-server","tag-server-mappath"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/2979","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=2979"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/2979\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=2979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=2979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=2979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}