tag:blogger.com,1999:blog-74352069229794724282024-02-20T06:42:13.275-08:00IKOSoftwareIKOSoftware.comhttp://www.blogger.com/profile/14753700350996964921noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7435206922979472428.post-56580551495264494012007-10-04T10:44:00.000-07:002007-10-04T10:48:30.896-07:00Drop database even it is in useThe following script will delete a database even if it is in use:<br /><br /><br />EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'MyDatabase'<br />GO<br />USE [master]<br />GO<br />ALTER DATABASE [MyDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE<br />GO<br />ALTER DATABASE [MyDatabase] SET SINGLE_USER<br />GO<br />USE [master]<br />GO<br />DROP DATABASE [MyDatabase]<br />GO<br /><br /><br />Hope it helps.<br /><a href="http://www.ikosoftware.com/">http://www.IKOSoftware.com</a>IKOSoftware.comhttp://www.blogger.com/profile/14753700350996964921noreply@blogger.com1tag:blogger.com,1999:blog-7435206922979472428.post-86749688779192928832007-09-05T09:03:00.001-07:002007-09-05T09:06:01.432-07:00Password managerI found the following application was a life saver. KeePass ( http://keepass.info/ ) is a free, open-source, light-weight and easy-to-use password safe for Windows. You can store your passwords in a highly-encrypted database locked with one master key or key-disk.<br /><br />Hope it helps.<br /><a href="http://www.ikosoftware.com/">http://www.IKOSoftware.com</a>IKOSoftware.comhttp://www.blogger.com/profile/14753700350996964921noreply@blogger.com0tag:blogger.com,1999:blog-7435206922979472428.post-54451326855279411652007-08-20T12:54:00.000-07:002007-08-20T13:13:20.651-07:00How to force a page to use SSL (HTTPS)The following sample code will force pages to use SSL (https) with ASP.NET 2.0:<br /><br /><br /><br /><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><br /></div><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px"><span style="color:green;">//this is the current url </span></pre></div><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px">System.<span style="color:#2b91af;">Uri</span> currentUrl = System.Web.<span style="color:#2b91af;">HttpContext</span>.Current.Request.Url;</pre></div><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px"><span style="color:green;">//don't redirect if this is localhost</span></pre></div><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px"><span style="color:blue;">if</span> (!currentUrl.IsLoopback)</pre></div><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px">{</pre></div><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px"> <span style="color:blue;">if</span> (!currentUrl.Scheme.Equals(<span style="color:#2b91af;">Uri</span>.UriSchemeHttps, <span style="color:#2b91af;">StringComparison</span>.CurrentCultureIgnoreCase))</pre></div><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px"> {</pre></div><div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"><pre style="MARGIN: 0px"> <span style="color:green;">//build the secure uri</span></pre></div><div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"><pre style="MARGIN: 0px"> System.<span style="color:#2b91af;">UriBuilder</span> secureUrlBuilder = <span style="color:blue;">new</span> <span style="color:#2b91af;">UriBuilder</span>(currentUrl);</pre></div><div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"><pre style="MARGIN: 0px"> secureUrlBuilder.Scheme = <span style="color:#2b91af;">Uri</span>.UriSchemeHttps;</pre></div><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><pre style="MARGIN: 0px"> <span style="color:green;">//use the default port. </span></pre></div><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><pre style="MARGIN: 0px"> secureUrlBuilder.Port = -1;</pre></div><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><pre style="MARGIN: 0px"> <span style="color:green;">//redirect and end the response.</span></pre></div><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><pre style="MARGIN: 0px"> System.Web.<span style="color:#2b91af;">HttpContext</span>.Current.Response.Redirect(secureUrlBuilder.Uri.ToString());</pre></div><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><pre style="MARGIN: 0px"> }</pre></div><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><pre style="MARGIN: 0px">}</pre></div><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"></div><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><a href="http://www.ikosoftware.com/"></a></div></div><br /><br />Hope it helps.<br /><a href="http://www.ikosoftware.com/">http://www.ikosoftware.com/</a>IKOSoftware.comhttp://www.blogger.com/profile/14753700350996964921noreply@blogger.com2tag:blogger.com,1999:blog-7435206922979472428.post-62354192555288820412007-08-14T17:51:00.000-07:002007-08-14T18:04:35.649-07:00Use ISO without burning it to a disk.There is a way to use that ISO without burning it to a disk. And it's free!<br /><br />Download Microsoft Virtual CD-ROM Control Panel v2.0.1.1 - a free tool from Microsoft to mount ISO images as drives.<br /><a href="http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe">http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe</a><br /><br />Follow the instruction from the ReadMe.txt file:<br /><br /><blockquote>Readme for Virtual CD-ROM Control Panel v2.0.1.1<br />THIS TOOL IS UNSUPPORT BY MICROSOFT PRODUCT SUPPORT SERVICES<br />System Requirements<br />===================<br />- Windows XP Home or Windows XP Professional<br /><br />Installation instructions<br />=========================<br />1. Copy VCdRom.sys to your %systemroot%\system32\drivers folder.<br />2. Execute VCdControlTool.exe<br />3. Click "Driver control"<br />4. If the "Install Driver" button is available, click it. Navigate to the<br />%systemroot%\system32\drivers folder, select VCdRom.sys, and click Open.<br />5. Click "Start"<br />6. Click OK<br />7. Click "Add Drive" to add a drive to the drive list. Ensure that the<br />drive added is not a local drive. If it is, continue to click "Add Drive" until<br />an unused drive letter is available.<br />8. Select an unused drive letter from the drive list and click<br />"Mount".<br />9. Navigate to the image file, select it, and click "OK". UNC naming<br />conventions should not be used, however mapped network drives should be<br />OK.<br />You may now use the drive letter as if it were a local CD-ROM device.<br />When you are finished you may unmount, stop, and remove the driver from memory using the driver control.<br /></blockquote>IKOSoftware.comhttp://www.blogger.com/profile/14753700350996964921noreply@blogger.com0tag:blogger.com,1999:blog-7435206922979472428.post-12882143171571881382007-08-14T07:21:00.000-07:002007-08-14T18:07:30.000-07:00ASP.NET 2.0: CacheKeyDependencyDuring the development of Issue Tracker ( <a href="http://www.ikosoftware.com/">http://www.ikosoftware.com/</a> ) , I had a lot of problems with <strong>CacheKeyDependency</strong>. It simply didn't work. The documentation in MSDN is definitely lacking. I couldn't find any good information on the internet either.<br /><br />After a lot of trial and error attempts I finally made it work. Let's go through the following code to demonstrate the technique.<br /><br />Add DataSource objects to the page.<br />Enable cache for the DataSource object:<br /><br />.... asp:sqldatasource runat="server" CacheKeyDependency="MyTestKey"....<br /><br />In code behind check Cache[CacheKeyDependency]. If it does not exists, create it:<br /><br /><br /><?xml:namespace prefix = asp /><asp:sqldatasource runat="server" cachekeydependency="MyTestKey"><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px"> </pre><br /><pre style="MARGIN: 0px"> <span style="color:blue;">protected</span> <span style="color:blue;">void</span> Page_Load(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">EventArgs</span> e)</pre><pre style="MARGIN: 0px"> {</pre><pre style="MARGIN: 0px"> <span style="color:blue;">if</span> (!IsPostBack)</pre><pre style="MARGIN: 0px"> {</pre><pre style="MARGIN: 0px"> <span style="color:green;">//create CacheKeyDependency if it does not exists</span></pre><pre style="MARGIN: 0px"> <span style="color:blue;">if</span> (Cache[SqlDataSource1.CacheKeyDependency] == <span style="color:blue;">null</span>)</pre><pre style="MARGIN: 0px"> {</pre><pre style="MARGIN: 0px"> Cache[SqlDataSource1.CacheKeyDependency] = <span style="color:blue;">new</span> <span style="color:blue;">object</span>();</pre><pre style="MARGIN: 0px"> }</pre><pre style="MARGIN: 0px"> }</pre><pre style="MARGIN: 0px"> }</pre><br /></div><br /><br /><br />To refresh the cache use the following code:<br /><br /><br /><div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"><br /><pre style="MARGIN: 0px"> Cache[SqlDataSource1.CacheKeyDependency] = <span style="color:blue;">new</span> <span style="color:blue;">object</span>(); </pre><pre style="MARGIN: 0px"> </pre><pre style="MARGIN: 0px"> </pre><pre style="MARGIN: 0px"> </pre><pre style="MARGIN: 0px"><br /></pre></div><br />You can have one CacheKeyDependency key word for multiple DataSource objects, so when you run<br /><pre></pre><div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"><br /><pre style="MARGIN: 0px">Cache["MyTestKey"] = <span style="color:#0000ff;">new</span> <span style="color:blue;">object</span>(); </pre><pre style="MARGIN: 0px"> </pre></div>all the DataSource objects will have to renew the cache.<br /><br /><br />Hope it helps.<br /><br /></asp:sqldatasource><asp:sqldatasource runat="server" cachekeydependency="MyTestKey"></asp:sqldatasource>IKOSoftware.comhttp://www.blogger.com/profile/14753700350996964921noreply@blogger.com7tag:blogger.com,1999:blog-7435206922979472428.post-45746132871428449802007-08-07T17:05:00.001-07:002007-08-22T08:43:15.345-07:00Creating multiline tooltips (Using Environment.NewLine in tooltips)<a href="http://2.bp.blogspot.com/_GO9mu6wres4/RruHrXIbLXI/AAAAAAAAAAk/L0nTFSnER1M/s1600-h/tooltip.jpg"><img id="BLOGGER_PHOTO_ID_5096816582313323890" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_GO9mu6wres4/RruHrXIbLXI/AAAAAAAAAAk/L0nTFSnER1M/s320/tooltip.jpg" border="0" /></a><br /><br /><br /><br /><br /><br /><br /><br />Just a small trick to separate lines in the standard tooltip (thanks, Heath!):<br /><br />Code:<br /><div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" ><pre style="MARGIN: 0px">Label1.ToolTip = <span style="color:#a31515;">"Line 1"</span> + <span style="color:#2b91af;">Environment</span>.NewLine + <span style="color:#a31515;">"Line 2"</span> + <span style="color:#2b91af;">Environment</span>.NewLine + <span style="color:#a31515;">"Line 3"</span>;</pre></div><br /><br />Hope it helps.<br /><a href="http://www.ikosoftware.com/">http://www.ikosoftware.com/</a>IKOSoftware.comhttp://www.blogger.com/profile/14753700350996964921noreply@blogger.com1