Click here to Skip to main content
       

ASP.NET

 
GeneralRe: How to Get Local Area IP Address? PinmemberNandan Basak4-Feb-13 2:05 
QuestionAn error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. PinmemberRKSPradeep4-Nov-12 20:11 
JokeRe: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Pinmembern.podbielski4-Nov-12 20:52 
AnswerRe: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Pinmemberryanb315-Nov-12 5:37 
Questionvariable for aspx and all its ascx Pinmemberjrahma4-Nov-12 8:25 
AnswerRe: variable for aspx and all its ascx Pinmembern.podbielski4-Nov-12 10:17 
GeneralRe: variable for aspx and all its ascx PinmemberAmir Jalilifard5-Nov-12 8:15 
Questionhttpmodule, context.items.add("originalUrl") Pinmemberjkirkerx3-Nov-12 19:44 
I'm experimenting with the httpModule, using XP and IIS5.1, asp.net 4.0, in which I want to take a file called display.aspx?pNp=XXXX and turn it into a file name XXXX.aspx.
 
So I wrote the first part, I know what context.Items("originalUrl") is for, but I'm not sure if I actually need it, because I don't don't have the second part written or working yet. It's been awhile since my last 3 failures at attempting this.
 
I'd like to get another set of eyes on my code, before I procede, in case I really blew it here. And see if there are any mistakes.
 
It seems to work, and I get the error message below, so I figure it's ok.
 
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.
 
Requested URL: /EN-US/part-lookup/catagory/XXXX.aspx
 
 
Imports Microsoft.VisualBasic
 
Public Class http_module_Details
    Implements IHttpModule
 
    Public Sub Init(context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
 
        AddHandler context.BeginRequest, AddressOf context_BeginRequest
        AddHandler context.PreRequestHandlerExecute, AddressOf context_PreRequestHandlerExecute
        AddHandler context.EndRequest, AddressOf context_EndRequest
 
    End Sub
    Private Sub context_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
 
        Dim application As HttpApplication = DirectCast(sender, HttpApplication)
        Dim context As HttpContext = application.Context
 
        If Not context.Items("originalUrl") Is Nothing Then
            context.RewritePath(Convert.ToString(context.Items("originalUrl")))
        End If
 
    End Sub
    Private Sub context_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
 
        Dim application As HttpApplication = DirectCast(sender, HttpApplication)
        Dim context As HttpContext = application.Context
 
        If (context.Request.RawUrl.ToLower.Contains("details.aspx")) Then
            context.Items("originalUrl") = context.Request.RawUrl
        End If
 
        Dim originalPath As String = context.Request.Url.ToString()
        If Not context.Request.QueryString("pNp") Is Nothing Then
            Dim cP As String = context.Request.ServerVariables("SCRIPT_NAME")
            cP = cP.Replace("Details.aspx", "").Replace("details.aspx", "")
            Dim pn_P As String = HttpUtility.UrlDecode(context.Request.QueryString("pNp"))
            Dim scriptName As String = cP & pn_P & ".aspx"
            context.RewritePath(scriptName)
        End If
 
    End Sub
    Private Sub context_EndRequest(ByVal sender As Object, ByVal e As EventArgs)
 

    End Sub
    Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
 
    End Sub
 
End Class
 

Questionhow to split a page using frameset Pinmemberfahad.11-Nov-12 2:02 
AnswerRe: how to split a page using frameset Pinmemberjkirkerx4-Nov-12 7:58 
QuestionHow do I call a remote Web Service from an Asp.net application? PinmemberNada Adel31-Oct-12 23:28 
AnswerRe: How do I call a remote Web Service from an Asp.net application? PinmentorKeith Barrow1-Nov-12 5:54 
AnswerRe: How do I call a remote Web Service from an Asp.net application? PinmemberMathlab2-Nov-12 6:22 
AnswerRe: How do I call a remote Web Service from an Asp.net application? [modified] Pinmemberjkirkerx2-Nov-12 18:41 
Generalasp.net Pinmemberrifayee31-Oct-12 22:50 
GeneralRe: asp.net PinmemberThink On1-Nov-12 4:39 
GeneralRe: asp.net Pinmemberrifayee1-Nov-12 19:13 
GeneralRe: asp.net Pinmembermark merrens1-Nov-12 13:16 
GeneralRe: asp.net PinmemberThink On1-Nov-12 20:29 
Questionwhat is different between DataAdapter.Update( ) and DataSetAcceptChange( ) in ADO.Net PinmemberRKSPradeep31-Oct-12 19:58 
AnswerRe: what is different between DataAdapter.Update( ) and DataSetAcceptChange( ) in ADO.Net PinmvpSandeep Mewara3-Nov-12 7:43 
QuestionHow to implement a component that facilitates Sftp in .net PinmemberMember 787327431-Oct-12 19:56 
AnswerRe: How to implement a component that facilitates Sftp in .net PinmvpSandeep Mewara3-Nov-12 7:46 
Questioncopy sheets one work book to other work book using open xml in windows azure Pinmemberprakashreddy1730-Oct-12 23:06 
Questiondesign a master page PinmemberRKSPradeep30-Oct-12 20:50 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 30 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid