Click here to Skip to main content
15,908,675 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: time limit validation Pin
Arindam Tewary26-Feb-08 1:20
professionalArindam Tewary26-Feb-08 1:20 
GeneralRe: time limit validation Pin
eyeseetee26-Feb-08 2:56
eyeseetee26-Feb-08 2:56 
GeneralRe: time limit validation Pin
Not Active26-Feb-08 3:07
mentorNot Active26-Feb-08 3:07 
QuestionHow to add a checkbox conrol to datalist or datagrid in single cell like(2,2) Pin
shames(Sam)26-Feb-08 1:08
shames(Sam)26-Feb-08 1:08 
AnswerRe: How to add a checkbox conrol to datalist or datagrid in single cell like(2,2) Pin
varshavmane26-Feb-08 1:56
varshavmane26-Feb-08 1:56 
GeneralAsp.net fromFROM keyword not found where expected Pin
Waqas Hasan26-Feb-08 0:59
Waqas Hasan26-Feb-08 0:59 
QuestionGridView FindControl.. Pin
Sasmi_Office26-Feb-08 0:53
Sasmi_Office26-Feb-08 0:53 
GeneralScrewTurn CMS [modified] Pin
ASPnoob26-Feb-08 0:30
ASPnoob26-Feb-08 0:30 
Hello all,
I've been tinkering with a small Content Management System called ScrewTurnVisualizer that I've found on http://blog.lavablast.com/post/2008/01/Dirt-Simple-ASPNET-CMS-using-the-ScrewTurn-Wiki.aspx
I have converted the code for this short program, which was written in C# to VB with a converter I've found online. When I tried to build and run this program in VS2003, I've got more than 3 dozen error messages. I'm wondering if this CMS is written using dotnet 2.0 and if that is why I've been getting so many error messages. If it was indeed written using dotnet 2.0 could you please show me how to convert it so that it is compatible with VS2003? Below is the code that I've got after the C# conversion to VB. Any help will be greatly appreciated and thank you in advance for your time.
<br />
 <br />
<br />
<br />
Imports System<br />
Imports System.Collections.Generic<br />
Imports System.ComponentModel<br />
Imports System.Text<br />
Imports System.Web<br />
Imports System.Web.UI<br />
Imports System.Web.UI.WebControls<br />
Imports System.Net<br />
Imports System.IO<br />
Imports System.Text.RegularExpressions<br />
Imports System.Web.Caching<br />
<br />
<br />
Namespace LavaBlast.CustomControls<br />
    <defaultproperty("text")> _<br />
    <toolboxdata("><{0}:screwturnvisualizer runat="server"></{0}:screwturnvisualizer>")> _<br />
    Public Class ScrewturnVisualizer<br />
        Inherits WebControl<br />
        <bindable(true)> _<br />
        <category("data")> _<br />
        <defaultvalue("")> _<br />
        <localizable(true)> _<br />
        Public Property PageName() As String<br />
            Get<br />
                Dim s As String = DirectCast(ViewState("PageName"), String)<br />
                Return (IIf((s Is Nothing),[String].Empty,s))<br />
            End Get<br />
            <br />
            Set<br />
                ViewState("PageName") = value<br />
            End Set<br />
        End Property<br />
        <br />
        <bindable(true)> _<br />
        <category("data")> _<br />
        <defaultvalue("")> _<br />
        <localizable(true)> _<br />
        Public Property BaseURL() As String<br />
            Get<br />
                Dim s As String = DirectCast(ViewState("BaseURL"), String)<br />
                If s IsNot Nothing AndAlso Not s.EndsWith("/") Then<br />
                    s += "/"<br />
                End If<br />
                Return (IIf((s Is Nothing),[String].Empty,s))<br />
            End Get<br />
            <br />
            Set<br />
                ViewState("BaseURL") = value<br />
            End Set<br />
        End Property<br />
        Public ReadOnly Property FullURL() As String<br />
            Get<br />
                Return GetFullPath(BaseURL, PageName)<br />
            End Get<br />
        End Property<br />
        <br />
        <bindable(true)> _<br />
        <category("data")> _<br />
        <defaultvalue("")> _<br />
        <localizable(true)> _<br />
        Public Property CacheText() As Boolean<br />
            Get<br />
                Return CBool((IIf(ViewState("CacheText") Is Nothing, (ViewState("CacheText") = True), ViewState("CacheText"))))<br />
            End Get<br />
            Set<br />
                ViewState("CacheText") = value<br />
                If Not value Then<br />
                    If Page IsNot Nothing Then<br />
                        Page.Cache.Remove("ScrewturnVisualizer_" + FullURL)<br />
                    End If<br />
                End If<br />
            End Set<br />
        End Property<br />
        <br />
        Public Function GetPageContents() As String<br />
            If CacheText AndAlso Me.Page.Cache("ScrewturnVisualizer_" + FullURL) IsNot Nothing Then<br />
                Return Me.Page.Cache("ScrewturnVisualizer_" + FullURL).ToString()<br />
            End If<br />
            <br />
            Dim s As String = GetScrewturnPageContent(BaseURL, PageName)<br />
            <br />
            If CacheText Then<br />
                Me.Page.Cache.Add("ScrewturnVisualizer_" + FullURL, s, Nothing, Cache.NoAbsoluteExpiration, New TimeSpan(1, 0, 0), CacheItemPriority.[Default], _<br />
                	Nothing)<br />
            End If<br />
            <br />
            Return s<br />
        End Function<br />
        <br />
        Public Shared Function GetFullPath(ByVal baseUrl As String, ByVal pageName As String) As String<br />
            Return baseUrl + "Print.aspx?Page=" + pageName<br />
        End Function<br />
        <br />
        Public Shared Function GetScrewturnPageContent(ByVal baseUrl As String, ByVal pageName As String) As String<br />
            Dim s As String = ""<br />
            Try<br />
                Dim req As HttpWebRequest = DirectCast(HttpWebRequest.Create(GetFullPath(baseUrl, pageName)), HttpWebRequest)<br />
                req.UserAgent = "LavaBlast"<br />
                req.CookieContainer = New CookieContainer()<br />
                Dim response As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)<br />
                response.Cookies = req.CookieContainer.GetCookies(req.RequestUri)<br />
                <br />
                Dim reader As New StreamReader(response.GetResponseStream())<br />
                s = reader.ReadToEnd()<br />
                reader.Close()<br />
                <br />
                s = Regex.Replace(s, "<a[^>]*>Edit", "", RegexOptions.Compiled)<br />
                s = Regex.Replace(s, "^.*<input.*id value=".[^""]*""" />", "", RegexOptions.Compiled Or RegexOptions.Singleline)<br />
                s = Regex.Replace(s, ".*$", "", RegexOptions.Compiled Or RegexOptions.Singleline)<br />
                s = Regex.Replace(s, "<h1 class=".pagetitle.">[^<]*</h1>", "", RegexOptions.Compiled)<br />
                s = Regex.Replace(s, "<h2 class=".seperator.">(?<title>[^<]*)</title></h2>", "<h2>${title}</h2>", RegexOptions.Compiled)<br />
                <br />
                s = Regex.Replace(s, "GetFile.aspx.File=", "images/", RegexOptions.Compiled)<br />
            Catch ex As Exception<br />
                System.Diagnostics.Debug.WriteLine([String].Format("An error has occurred accessing {0}.<br />{1}", baseUrl + "Print.aspx?Page=" + pageName, ex.ToString()))<br />
                s = "An error has occurred."<br />
            End Try<br />
            Return s<br />
        End Function<br />
        <br />
        Protected Overloads Overrides Sub RenderContents(ByVal output As HtmlTextWriter)<br />
            output.Write(GetPageContents())<br />
        End Sub<br />
    End Class<br />
End Namespace<br />
<br />
</a[^></localizable(true)></defaultvalue("")></category("data")></bindable(true)></localizable(true)></defaultvalue("")></category("data")></bindable(true)></localizable(true)></defaultvalue("")></category("data")></bindable(true)></toolboxdata("></defaultproperty("text")>


modified on Tuesday, February 26, 2008 7:12 AM

GeneralRadioButtonList not functioning Pin
codingrocks26-Feb-08 0:29
codingrocks26-Feb-08 0:29 
Questionpostback url of lik button and row bound of gridview Pin
Sonia Gupta26-Feb-08 0:10
Sonia Gupta26-Feb-08 0:10 
GeneralRe: postback url of lik button and row bound of gridview Pin
Member 336757026-Feb-08 0:22
Member 336757026-Feb-08 0:22 
GeneralYahoo IM from Classic ASP Pin
nhss25-Feb-08 23:19
nhss25-Feb-08 23:19 
GeneralRe: Yahoo IM from Classic ASP Pin
Christian Graus25-Feb-08 23:27
protectorChristian Graus25-Feb-08 23:27 
GeneralDelete directory Pin
frndjust25-Feb-08 23:17
frndjust25-Feb-08 23:17 
GeneralRe: Delete directory Pin
Christian Graus25-Feb-08 23:28
protectorChristian Graus25-Feb-08 23:28 
GeneralSet Resolution of uploaded image Pin
frndjust25-Feb-08 23:15
frndjust25-Feb-08 23:15 
GeneralRe: Set Resolution of uploaded image Pin
Christian Graus25-Feb-08 23:17
protectorChristian Graus25-Feb-08 23:17 
GeneralRe: Set Resolution of uploaded image Pin
frndjust25-Feb-08 23:22
frndjust25-Feb-08 23:22 
GeneralRe: Set Resolution of uploaded image Pin
Christian Graus25-Feb-08 23:30
protectorChristian Graus25-Feb-08 23:30 
Generalpage locking Pin
eyeseetee25-Feb-08 22:53
eyeseetee25-Feb-08 22:53 
GeneralRe: page locking Pin
Christian Graus25-Feb-08 23:03
protectorChristian Graus25-Feb-08 23:03 
GeneralRe: page locking Pin
eyeseetee25-Feb-08 23:52
eyeseetee25-Feb-08 23:52 
GeneralRe: page locking Pin
Christian Graus26-Feb-08 0:04
protectorChristian Graus26-Feb-08 0:04 
GeneralRe: page locking Pin
eyeseetee26-Feb-08 0:28
eyeseetee26-Feb-08 0:28 
QuestionSession id in URL [modified] Pin
Krazy Programmer25-Feb-08 22:40
Krazy Programmer25-Feb-08 22:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.