Control Resource embedding

Source: Internet
Author: User
Tags dbx fdf pkcs12 pkcs7 rfc822
Step 1: Drag js files and other files into the Resource. resx Resource Management window, that is, let the IDE dynamically add management code to our resources in the Resource. Designer. resx file.
Step 2: To register these files in our program set, you can register these files in AssemblyInfo. cs, or register them out of the namespace in the control cs file. The example of the registration format is.
[Assembly: WebResource ("TPI. Web. UI. WebSearch. Resources. jscript. js", "text/javascript")]
If you are familiar with Attribute, you will know that this is what the WebResourceAttribute class is working on. Its constructor is,
Public WebResourceAttribute (string webResource, string contentType). The parameter description on MSDN is,
WebResource: The name of the of Web resource;
ContentType: The type of resource, such as "image/gif" or "text/javascript ".
For the two parameters, contentType is very easy to understand, but what is webResource? I tested it and it may consist of three parts.
WebResource = default namespace of the Assembly + relative path + file name (including suffix), which is distinguished by color.
Step 3: How to Use
At this point, we have done a general deal. We can say that after the first step is completed, we can use
Page. ClientScript. RegisterClientScriptBlock (this. GetType (), "jscript", Resource. JScript, true );
Method To Get The js we want, but it will write in the html code, the code is "messy", and the second is not conducive to cache loading.
Therefore, we want to load the file in <script src = "../JS/jscript. js" type = "text/javascript"> </script> mode on the page,
So we need to register the second step and find the method.
Page. clientScript. registerClientScriptInclude (this. getType (), "jscript", Page. clientScript. getWebResourceUrl (this. getType (), "TPI. web. UI. webSearch. resources. jscript. js "));
So we found that the page has
<Script src = "/NonAcademic/WebResource. axd? D = plain & amp; t = 633390378453593750 "type =" text/javascript "> </script>
Officially what we want.
But it was found that js was not loaded at all. Why?
How long has this problem plagued me? I finally found it out. It is a small problem, that is, the "generate operation" attribute of the resource js file has always been "NONE ", set it to "embedded resource.

In addition, we just talked about contentType. We are familiar with common "image/gif" and "text/javascript", but there are many contentType values. We can say that the control can be embedded into resources.
There are many types, such as images, texts, and videos. To sum up,
-----------------------------------------------
". *" = "Application/octet-stream"
". 001" = "application/x-001"
". 301" = "application/x-301"
". 323" = "text/h323"
". 906" = "application/x-906"
". 907" = "Fig/907"
". A11" = "application/x-a11"
". Acp" = "audio/x-mei-aac"
". Ai" = "application/postscript"
". Aif" = "audio/aiff"
". Aifc" = "audio/aiff"
". Aiff" = "audio/aiff"
". Anv" = "application/x-anv"
". Asa" = "text/asa"
". Asf" = "video/x-ms-asf"
". Asp" = "text/asp"
". Asx" = "video/x-ms-asf"
". Au" = "audio/basic"
". Avi" = "video/avi"
". Awf" = "application/vnd. adobe. workflow"
". Biz" = "text/xml"
". Bmp" = "application/x-bmp"
". Bot" = "application/x-bot"
". C4t" = "application/x-c4t"
". C90" = "application/x-c90"
". Cal" = "application/x-cals"
". Cat" = "application/vnd. ms-pki.seccat"
". Cdf" = "application/x-netcdf"
". Cdr" = "application/x-cdr"
". Cel" = "application/x-cel"
". Cer" = "application/x-x509-ca-cert"
". Cg4" = "application/x-g4"
". Cgm" = "application/x-cgm"
". Cit" = "application/x-cit"
". Class" = "java /*"
". CRF" = "text/xml"
". Cmp" = "application/x-cmp"
". Cmx" = "application/x-cmx"
". Cot" = "application/x-cot"
". Crl" = "application/pkix-crl"
". Crt" = "application/x-x509-ca-cert"
". Csi" = "application/x-csi"
". Css" = "text/css"
". Cut" = "application/x-cut"
". Dbf" = "application/x-dbf"
". Dbm" = "application/x-dbm"
". Dbx" = "application/x-dbx"
". Dcd" = "text/xml"
". Dcx" = "application/x-dcx"
". Der" = "application/x-x509-ca-cert"
". Dgn" = "application/x-dgn"
". Dib" = "application/x-dib"
". Dll" = "application/x-msdownload"
". Doc" = "application/msword"
". Dot" = "application/msword"
". Drw" = "application/x-drw"
". Dtd" = "text/xml"
". Dwf" = "Model/vnd. dwf"
". Dwf" = "application/x-dwf"
". Dwg" = "application/x-dwg"
". Dxb" = "application/x-dxb"
". Dxf" = "application/x-dxf"
". Edn" = "application/vnd. adobe. edn"
". Emf" = "application/x-emf"
". Eml" = "message/rfc822"
". Ent" = "text/xml"
". Epi" = "application/x-epi"
". Eps" = "application/x-ps"
". Eps" = "application/postscript"
". Etd" = "application/x-ebx"
". Exe" = "application/x-msdownload"
". Fax" = "image/fax"
". Fdf" = "application/vnd. fdf"
". Fif" = "application/fractals"
". Fo" = "text/xml"
". Frm" = "application/x-frm"
". G4" = "application/x-g4"
". Gbr" = "application/x-gbr"
". Gcd" = "application/x-gcd"
". Gif" = "image/gif"
". Gl2" = "application/x-gl2"
". Gp4" = "application/x-gp4"
". Hgl" = "application/x-hgl"
". Hmr" = "application/x-hmr"
". Hpg" = "application/x-hpgl"
". Hpl" = "application/x-hpl"
". Hqx" = "application/mac-binhex40"
". Hrf" = "application/x-hrf"
". Hta" = "application/hta"
". Htc" = "text/x-component"
". Htm" = "text/html"
". Html" = "text/html"
". Htt" = "text/webviewhtml"
". Htx" = "text/html"
". Icb" = "application/x-icb"
". Ico" = "image/x-icon"
". Ico" = "application/x-ico"
". Iff" = "application/x-iff"
". Ig4" = "application/x-g4"
". Ig" = "application/x-ig"
". Iii" = "application/x-iphone"
". Img" = "application/x-img"
". Ins" = "application/x-internet-signup"
". Isp" = "application/x-internet-signup"
". IVF" = "video/x-ivf"
". Java" = "java /*"
". Jfif" = "image/jpeg"
". Jpe" = "image/jpeg"
". Jpe" = "application/x-jpe"
". Jpeg" = "image/jpeg"
". Jpg" = "image/jpeg"
". Jpg" = "application/x-jpg"
". Js" = "application/x-javascript"
". Jsp" = "text/html"
". La1" = "audio/x-liquid-file"
". Lar" = "application/x-laplayer-reg"
". Latex" = "application/x-latex"
". Lavs" = "audio/x-liquid-secure"
". Lbm" = "application/x-lbm"
". Lmsff" = "audio/x-la-lms"
". Ls" = "application/x-javascript"
". Ltr" = "application/x-ltr"
". M1v" = "video/x-mpeg"
". M2v" = "video/x-mpeg"
". M3u" = "audio/mpegurl"
". M4e" = "video/mpeg4"
". Mac" = "application/x-mac"
". Man" = "application/x-troff-man"
". Math" = "text/xml"
". Mdb" = "application/msaccess"
". Mdb" = "application/x-mdb"
". Mfp" = "application/x-shockwave-flash"
". Mht" = "message/rfc822"
". Mhtml" = "message/rfc822"
". Mi" = "application/x-mi"
". Mid" = "audio/mid"
". Midi" = "audio/mid"
". Mil" = "application/x-mil"
". Mml" = "text/xml"
". Mnd" = "audio/x-musicnet-download"
". Mns" = "audio/x-musicnet-stream"
". Mocha" = "application/x-javascript"
". Movie" = "video/x-sgi-movie"
". Mp1" = "audio/mp1"
". Mp2" = "audio/mp2"
". Mp2v" = "video/mpeg"
". Mp3" = "audio/mp3"
". Mp4" = "video/mpeg4"
". Mpa" = "video/x-mpg"
". Mpd" = "application/vnd. ms-project"
". Mpe" = "video/x-mpeg"
". Mpeg" = "video/mpg"
". Mpg" = "video/mpg"
". Mpga" = "audio/rn-mpeg"
". Mpp" = "application/vnd. ms-project"
". Mps" = "video/x-mpeg"
". Mpt" = "application/vnd. ms-project"
". Mpv" = "video/mpg"
". Mpv2" = "video/mpeg"
". Mpw" = "application/vnd. ms-project"
". Mpx" = "application/vnd. ms-project"
". CTX" = "text/xml"
". Mxp" = "application/x-mmxp"
". Net" = "image/pnetvue"
". Nrf" = "application/x-nrf"
". Nws" = "message/rfc822"
". Odc" = "text/x-ms-odc"
". Out" = "application/x-out"
". P10" = "application/pkcs10"
". P12" = "application/x-pkcs12"
". P7b" = "application/x-pkcs7-certificates"
". P7c" = "application/pkcs7-mime"
". P7m" = "application/pkcs7-mime"
". P7r" = "application/x-pkcs7-certreqresp"
". P7s" = "application/pkcs7-signature"
". Pc5" = "application/x-pc5"
". Pci" = "application/x-pci"
". Pcl" = "application/x-pcl"
". Pcx" = "application/x-pcx"
". Pdf" = "application/pdf"
". Pdf" = "application/pdf"
". Pdx" = "application/vnd. adobe. pdx"
". Pfx" = "application/x-pkcs12"
". Pgl" = "application/x-pgl"
". Pic" = "application/x-pic"
". Pko" = "application/vnd. ms-pki.pko"
". Pl" = "application/x-perl"
". Plg" = "text/html"
". Pls" = "audio/scpls"
". Plt" = "application/x-plt"
". Png" = "image/png"
". Png" = "application/x-png"
". Pot" = "application/vnd. ms-powerpoint"
". Ppa" = "application/vnd. ms-powerpoint"
". Ppm" = "application/x-ppm"
". Pps" = "application/vnd. ms-powerpoint"
". Ppt" = "application/vnd. ms-powerpoint"
". Ppt" = "application/x-ppt"
". Pr" = "application/x-pr"
". Prf" = "application/pics-rules"
". Prn" = "application/x-prn"
". Prt" = "application/x-prt"
". Ps" = "application/x-ps"
". Ps" = "application/postscript"
". Ptn" = "application/x-ptn"
". Pwz" = "application/vnd. ms-powerpoint"
". R3t" = "text/vnd. rn-realtext3d"
". Ra" = "audio/vnd. rn-realaudio"
". Ram" = "audio/x-pn-realaudio"
". Ras" = "application/x-ras"
". Rat" = "application/rat-file"
". Rdf" = "text/xml"
". Rec" = "application/vnd. rn-recording"
". Red" = "application/x-red"
". Rgb" = "application/x-rgb"
". Rjs" = "application/vnd. rn-realsystem-rjs"
". Rjt" = "application/vnd. rn-realsystem-rjt"
". Rlc" = "application/x-rlc"
". Rle" = "application/x-rle"
". Rm" = "application/vnd. rn-realmedia"
". Rmf" = "application/vnd. adobe. rmf"
". Rmi" = "audio/mid"
". Rmj" = "application/vnd. rn-realsystem-rmj"
". Rmm" = "audio/x-pn-realaudio"
". Rmp" = "application/vnd. rn-rn_music_package"
". Rms" = "application/vnd. rn-realmedia-secure"
". Rmvb" = "application/vnd. rn-realmedia-vbr"
". Rmx" = "application/vnd. rn-realsystem-rmx"
". Rnx" = "application/vnd. rn-realplayer"
". Rp" = "image/vnd. rn-realpix"
". Rpm" = "audio/x-pn-realaudio-plugin"
". Rsml" = "application/vnd. rn-rsml"
". Rt" = "text/vnd. rn-realtext"
". Rtf" = "application/msword"
". Rtf" = "application/x-rtf"
". Rv" = "video/vnd. rn-realvideo"
". Sam" = "application/x-sam"
". Sat" = "application/x-sat"
". Sdp" = "application/sdp"
". Sdw" = "application/x-sdw"
". Sit" = "application/x-stuffit"
". Slb" = "application/x-slb"
". Sld" = "application/x-sld"
". Slk" = "drawing/x-slk"
". Smi" = "application/smil"
". Smil" = "application/smil"
". Smk" = "application/x-smk"
". Snd" = "audio/basic"
". Sol" = "text/plain"
". Sor" = "text/plain"
". Spc" = "application/x-pkcs7-certificates"
". Spl" = "application/futuresplash"
". Spp" = "text/xml"
". Ssm" = "application/streamingmedia"
". Sst" = "application/vnd. ms-pki.certstore"
". Stl" = "application/vnd. ms-pki.stl"
". Stm" = "text/html"
". Sty" = "application/x-sty"
". Svg" = "text/xml"
". Swf" = "application/x-shockwave-flash"
". Tdf" = "application/x-tdf"
". Tg4" = "application/x-tg4"
". Tga" = "application/x-tga"
". Tif" = "image/tiff"
". Tif" = "application/x-tif"
". Tiff" = "image/tiff"
". Tld" = "text/xml"
". Top" = "drawing/x-top"
". Torrent" = "application/x-bittorrent"
". Tsd" = "text/xml"
". Txt" = "text/plain"
". Uin" = "application/x-icq"
". Uls" = "text/iuls"
". Vcf" = "text/x-vcard"
". Vda" = "application/x-vda"
". Vdx" = "application/vnd. visio"
". Vml" = "text/xml"
". Vpg" = "application/x-vpeg005"
". Sealing" = "application/vnd. visio"
". Sealing" = "application/x-sealing"
". Vss" = "application/vnd. visio"
". Vst" = "application/vnd. visio"
". Vst" = "application/x-vst"
". Vsw" = "application/vnd. visio"
". Vsx" = "application/vnd. visio"
". Vtx" = "application/vnd. visio"
". Vxml" = "text/xml"
". Wav" = "audio/wav"
". Wax" = "audio/x-ms-wax"
". Wb1" = "application/x-wb1"
". Wb2" = "application/x-wb2"
". Wb3" = "application/x-wb3"
". Wbmp" = "image/vnd. wap. wbmp"
". Wiz" = "application/msword"
". Wk3" = "application/x-wk3"
". Wk4" = "application/x-wk4"
". Wkq" = "application/x-wkq"
". Wks" = "application/x-wks"
". Wm" = "video/x-ms-wm"
". Wma" = "audio/x-ms-wma"
". Wmd" = "application/x-ms-wmd"
". Wmf" = "application/x-wmf"
". Wml" = "text/vnd. wap. wml"
". Wmv" = "video/x-ms-wmv"
". Wmx" = "video/x-ms-wmx"
". Wmz" = "application/x-ms-wmz"
". Wp6" = "application/x-wp6"
". Wpd" = "application/x-wpd"
". Wpg" = "application/x-wpg"
". Wpl" = "application/vnd. ms-wpl"
". Wq1" = "application/x-wq1"
". Wr1" = "application/x-wr1"
". Wri" = "application/x-wri"
". Wrk" = "application/x-wrk"
". Ws" = "application/x-ws"
". Ws2" = "application/x-ws"
". Wsc" = "text/scriptlet"
". Wsdl" = "text/xml"
". Wvx" = "video/x-ms-wvx"
". Xdp" = "application/vnd. adobe. xdp"
". Xdr" = "text/xml"
". Xfd" = "application/vnd. adobe. xfd"
". Xfdf" = "application/vnd. adobe. xfdf"
". Xhtml" = "text/html"
". Xls" = "application/vnd. ms-excel"
". Xls" = "application/x-xls"
". Xlw" = "application/x-xlw"
". Xml" = "text/xml"
". Xpl" = "audio/scpls"
". Xq" = "text/xml"
". Xql" = "text/xml"
". Xquery" = "text/xml"
". Xsd" = "text/xml"
". Xsl" = "text/xml"
". Xslt" = "text/xml"
". Xwd" = "application/x-xwd"
". X_ B" = "application/x-x_ B"
". X_t" = "application/x-x_t"
-----------------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.