1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Asp pages how to show html format in browser

Discussion in 'C#' started by knisarmughal, Sep 12, 2008.

  1. #1
    hello friends!


    i have designed my website in ASP, this website has large database in (make in database MS Access) i want to show our asp pages in browser html format. which is coding use behind this how can i create this script own website please help to me.......

    our website in ASP no in (ASP.NET / PHP
     
    knisarmughal, Sep 12, 2008 IP
  2. dwirch

    dwirch Well-Known Member

    Messages:
    239
    Likes Received:
    12
    Best Answers:
    1
    Trophy Points:
    135
    #2
    I'm a little unclear of your problem.

    If I read your post correctly, you've made an ASP page, but you are having trouble displaying output from a database in a browser?
     
    dwirch, Sep 18, 2008 IP
  3. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i think he means he wants showing .html or text instead of .asp

    try XMLHTTP get your .asp whole page txt string and create or copy to a .html file name you want.
     
    wacamoi, Sep 19, 2008 IP
  4. knisarmughal

    knisarmughal Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    knisarmughal, Sep 22, 2008 IP
  5. myheartbeats

    myheartbeats Banned

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    myheartbeats, Sep 29, 2008 IP
  6. mintoj

    mintoj Peon

    Messages:
    317
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    mintoj, Sep 29, 2008 IP
  7. qxiu

    qxiu Peon

    Messages:
    82
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    IIS rewirte url maybe can fits for you
     
    qxiu, Oct 14, 2008 IP
  8. Sean@WMS

    Sean@WMS Peon

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Sounds like you are looking for URL rewriting:

    You want domain.com/iarticles748.html rather than domain.com/iarticles.asp?pr=748

    The easiest way to deal with this is with LinkFreeze by Helicon Tech. LinkFreeze runs as an IIS snap in, so it will automatically write all of your .asp querry strings to, say, .html files; you don't need to do anything with the site. Everything is handled as 301 redirects too, so even links to the .asp? URLs will get redirected to the .html rewritten URL.

    So, domain.com/iarticles.asp?pr=748 would be rendered as something like domain.com/iarticles~pr~748.html

    However, if you are using shared hosting and your host doesn't already offer this, you may find that they aren't willing to install it . . . . which may mean you'll need to find a host that does offer it.

    Otherwise, in classic ASP, you're looking at having to develop a custom URL rewriter for the application. This would have the benefit of being able to rewrite the URL to something like domain.com/Article-Title-748.html or some such. I've developed these before.
     
    Sean@WMS, Oct 22, 2008 IP
  9. daviddalian

    daviddalian Well-Known Member

    Messages:
    311
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #9
    i can do this for you
    pls pm me
     
    daviddalian, Oct 25, 2008 IP
  10. mahacan

    mahacan Banned

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #10
    mahacan, Oct 25, 2008 IP
  11. Sean@WMS

    Sean@WMS Peon

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Yep. Looks like they're running the same sort of setup as we run. In a Windows hosting environment, it's not as simple as mod_rewrite on a LAMP server . . . . so, not many Windows hosts offer LinkFreeze or ISAPI_Rewrite.

    LinkFreeze is the simple solution, just as I described below. Just set it an forget it.

    ISAPI_Rewrite is MUCH more sophisticated and powerful, and can also handle everything .htaccess can handle on a LAMP server.

    PM me if you have any more questions about any of this.
     
    Sean@WMS, Oct 25, 2008 IP
  12. palme

    palme Active Member

    Messages:
    320
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #12
    that's a good simple solution, but..
    asp is dynamic programming language and html is static p.l., this means that, one asp file can make many html pages in the same time (not exactly), if any , which one html page you want to show
     
    palme, Nov 3, 2008 IP
  13. Sean@WMS

    Sean@WMS Peon

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I'm sorry, @palme,

    You do not know about which you speak.

    True ASP classic or .NET -- or any other server side scripting such as PHP, etc. -- processes code on the server first . . . . but this has NOTHING to do with XMLHTTP, as that just a "silent posts back" to the server in the same way a browser or robot would to retreive the client-side rendering of a page; so, you are completely wrong here.
     
    Sean@WMS, Nov 3, 2008 IP
  14. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #14
    How about a blank file 404.aspx with a code-behind file 404.aspx.vb similar to this:

    
    Imports System.IO
    Imports System.Net
    
    Partial Class _404
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim reqURL, myReq, myID As String
    
            reqURL = Request.Url.ToString
            reqURL = Right(reqURL, Len(reqURL) - InStr(reqURL, ";"))
    
            Dim uri As New Uri(reqURL)
            myReq = Replace(uri.AbsolutePath, "/", "")
            myReq = Replace(myReq, ".html", "")
            If Left(myReq, 8) = "article-" Then
                myID = Right(myReq, Len(myReq) - 8)
                'now load the page using loadWebPage sub
                loadWebPage("http://www.yourarticles.com/articles.aspx?articleID=" & myID)
            Else
                Response.Write("Error 404")
                'Response.Redirect("error404.html")
            End If
        End Sub
    
        Function loadWebPage(ByVal strURI As String) As String
            Dim r As WebResponse
            r = WebRequest.Create(New Uri(strURI)).GetResponse()
            Dim sr As New StreamReader(r.GetResponseStream())
            Do Until sr.EndOfStream
                Response.Write(sr.ReadToEnd)
            Loop
            sr.Close()
            r.Close()
        End Function
    End Class
    
    Code (markup):
    You can then set your 404 error page to 404.aspx (which most hosts should allow)....
    I tested this theory and it works...
    usage would be http://www.yourarticles.com/article-2134.html
    would load articles.aspx?articleID=2134

    This is ASP.net code but I'm sure it could be done in regular ASP also.
     
    camjohnson95, Nov 5, 2008 IP
    Sean@WMS likes this.
  15. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #15
    the 404.aspx file wouldn't be blank but would have the line:
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="404.aspx.vb" Inherits="_404" %>
     
    camjohnson95, Nov 5, 2008 IP
  16. Sean@WMS

    Sean@WMS Peon

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Yeah, but bouncing off custom 404 is so "old school". It's really better to handle this through IIS anymore when expedient.

    What's more, the "sweet spot" with URL rewriting here would be to be able to write out the links and pick up the URL rewrites at the application level so that you could search the db for title matches and thereby have keyword-rich URL's too. But as that would require a serverside search on the db via a custom 404 handling like this one here, it has to be application-specific.

    The easiest way to get up and going better than this suggestion here is with Helicon Tech's LinkFreeze as it will do the very same thing right in IIS . . . AND it will also rewrite all links generated by the application BEFORE they are pushed to the browser AND when they come in via some other referrer such as a search engine or link from another site.

    Yeah, this can be done with classic ASP too with the same essential logic. PM me if you are interested.
     
    Sean@WMS, Nov 5, 2008 IP
  17. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #17
    yeah I figured it had probably been done before... just a suggestion if installing the addin isn't an option.
     
    camjohnson95, Nov 5, 2008 IP
  18. Sean@WMS

    Sean@WMS Peon

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #18
    For sure @camjohnson95: point well taken. You are right.

    Not many Windows hosts are going to support advanced stuff like this -- though we do ( shameless plug! ).

    But, yeah, you've got a site specific way to handle it, @camjohnson95, that only requires custom 404 handling mapped to a processing script, and any host that doesn't support something like that is not a host worth hosting with.

    Nice contribution to this thread, IMHO.
     
    Sean@WMS, Nov 5, 2008 IP