Category Archives: asp.net

Multi-Language for ASP.Net Website Project using Satellite Assembly

Satellite assembly introduction A satellite assembly is a compiled library (DLL) that contains (“localizable”) resources such as strings, bitmaps, etc. You are likely to use them when creating a multilingual (UI) application. Satellite assemblies provide you with the capability of designing and deploying your solution to multiple cultures, rather than hard coding strings, bitmaps, etc.,… Read More »

新浪微博RSS生成器Ver 1.0 同步Twitter帐号

同时在用twitter和新浪微博,在twitter上主要看贴为主,在新浪微博上发帖比较多。于是就想到是否搞一下将新浪微博同步到twitter上。搜索了下,发现月光博客上提供了解决方案,不过稍有遗憾的是没有图片的同步。于是就自己用asp.net实现了下,用下来感觉还行,所以分享一下,同时提供源代码,如果有定制开发的朋友可以修改源码,但如果再发布时候,请注明出处,先谢谢了! 下载 新浪微博RSS生成器Ver 1.0 发布包 新浪微博RSS生成器Ver 1.0 源代码 部署步骤 首先,需要一个.Net Framework 2.0以上的IIS环境。 将SinaFeed_Bin_ver_1.0.zip解压以后,部署成网站或者虚拟目录。 将包里面的db文件夹赋予network service以及aspnet用户可写权限,偷懒且安全的话,给everyone即可。 运行起来的话,应该会是个Authentication Error的错误,这是正常的,因为接下来要配置下。 同步原理 用FeedBurner绑定Twitter,在FeedBurner中配置Rss源到SinaFeed应用。当FeedBurner每次来ping的时候,SinaFeed抓取新浪微博的内容,检查是否已经抓取过,把结果保存在Access数据库中,返回Rss给FeedBurner。 实现功能 同步新浪微博到Twitter。 包含图片链接,可配置。 包含转发原文及作者。 配置 在Web.Config里,有以下几个可以配置的选项: 代理服务器相关,例如你的网站访问外网需要代理的话,请设置一下配置: UseProxy , ProxyAddress, ProxyPort, ProxyDomain, ProxyUserName, ProxyUserPassword AuthCodeConfig 配置在应用里的授权码,自己设定一个,例如abc,当外面请求RSS的时候,需要在Url传递一个AuthCode,要和所配置的(abc)一直,程序才会返回结果,否则报Authentication Error错误。 AllowedUserIds 允许被处理新浪微博Id,如何得到你的Id?只要点击“关注”,在Url里就会出现你的Id,例如,我的Id是:1650422717 。SinaFeed支持多个Id,用逗号(,) 分割。 RssChannelUrl 所生成的Rss的ChannelUrl RssBaseGuid 所生成的Rss的唯一标识 RssTitle 所生成的Rss的标题 RssDescription 所生成的Rss的描述 使用步骤 例如,你部署在www.example.com上,虚拟目录为SinaFeed,你的新浪Id为1650422717,AuthCodeConfig你配置了jinweijiesinafeed那么 访问http://www.example.com/SinaFeed/Default.aspx?SinaUserId=1650422717&AuthCode=jinweijiesinafeed 就可以得到用户1650422717的Rss了。 另外的一些可传参数的配置: UseOriginalImage 是否使用原来的大图片,默认True,如果False的话,将会使用新浪微博的缩略图。… Read More »

Add UTF-8 Signature(BOM) at the Start of Response File

In ASP.Net, if you write a file to the client using code like this: HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader( "content-disposition", string.Format( "attachment; filename={0}", fileName ) ); HttpContext.Current.Response.ContentType = "application/ms-excel"; using( StringWriter sw = new StringWriter() ) { using( HtmlTextWriter htw = new HtmlTextWriter( sw ) ) { // Create a form to contain the grid Table table =… Read More »

Solve LoadPostData Not Firing Problem

When you are developing a server side control and want to handle some postback data. You can implement the IPostBackDataHandler interface. One issue I encountered is that the LoadPostData() method does not fire when the page posting back. Even if some values of textboxes are changed. To solve this issue, you need to call the… Read More »

Unable to start debugging on the web server. You do not have permission to debug the application. The URL for this project is in the Internet zone.

After I upgrading Internet Explorer, I got the following message that I cannot debug in visual studio: Unable to start debugging on the web server. You do not have permission to debug the application. The URL for this project is in the Internet zone. This is quite strange. Then I start granting permissions, iisreset… but… Read More »

Fix IE Blocking iFrame Cookies Problem

For security reason, Internet Explorer block the cookie manipulation of a page when the page is inside an iframe. This is really ridiculous because the two frames are totally two different sites and the security policy has already block the dom operation between the two frames. Why block the cookie operation inside the iframe itself?… Read More »

IE在ssl下CacheControl问题

今天碰到一个问题,IE在ssl(https)环境下,下载文件,会出现如下错误信息: “Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.” 查了一下KB (http://support.microsoft.com/default.aspx?scid=KB;EN-US;q316431&),原来是IE的一个bug,在2007年的时候已经有了,但微软到现在还没修复,唉~ 原因大致是这样的: 在ssl下,ie强制no-cache,如果no-cache已经在header里存在了,那么ie就不缓存文件了,所以文件找不到。(好莫名的说法啊) 尝试在下载页面里设置Response.CacheControl, 没有效果。最后,索性调用Response.ClearHeaders();,把Header全部清空,然后再设置Content-Type等属性,问题解决。