response.addheader

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rothariger

    response.addheader

    Hello, i have a problem, i must to make a response.redire ct, with a fixed
    header (authentication header) but i dont know how to do it... i make this,
    but im stuck here...


    Dim strURL As String = "http://localhost/webapplication1/webform1.aspx"
    Response.ClearH eaders()
    Response.ClearC ontent()
    Dim ReportWebReques t As System.Net.Http WebRequest =
    CType(System.Ne t.WebRequest.Cr eate(strURL), System.net.Http WebRequest)

    ReportWebReques t.Timeout = 10000
    ReportWebReques t.MaximumAutoma ticRedirections = 50

    Dim cCache = New System.Net.Cred entialCache
    cCache.Add(New Uri(strURL), "Basic", New
    System.Net.Netw orkCredential(" user", "pass", "domain"))

    ReportWebReques t.Credentials = cCache
    ReportWebReques t.PreAuthentica te = True

    Dim ReportWebRespon se As System.net.WebR esponse
    ReportWebRespon se = CType(ReportWeb Request.GetResp onse(),
    System.net.WebR esponse)

    Response.Redire ctLocation = strURL
    Dim i As Integer
    For i = 0 To ReportWebReques t.Headers.Count - 1
    Response.AddHea der(ReportWebRe quest.Headers.K eys(i).ToString (),
    ReportWebReques t.Headers.Item( i).ToString())
    Next

    add code here... ;) what could i make next? response redirect clear the
    header that i make... i dont know what to do...


    thanks to all!!!
  • Bruce Barker

    #2
    Re: response.addhea der

    a redirect is just a header, you could just do the redirect yourself.

    -- bruce (sqlwork.com)

    "Rothariger " <Rothariger@msn .com> wrote in message
    news:FE935591-B948-4F4C-B103-B2706DE7E3D9@mi crosoft.com...[color=blue]
    > Hello, i have a problem, i must to make a response.redire ct, with a fixed
    > header (authentication header) but i dont know how to do it... i make
    > this,
    > but im stuck here...
    >
    >
    > Dim strURL As String = "http://localhost/webapplication1/webform1.aspx"
    > Response.ClearH eaders()
    > Response.ClearC ontent()
    > Dim ReportWebReques t As System.Net.Http WebRequest =
    > CType(System.Ne t.WebRequest.Cr eate(strURL), System.net.Http WebRequest)
    >
    > ReportWebReques t.Timeout = 10000
    > ReportWebReques t.MaximumAutoma ticRedirections = 50
    >
    > Dim cCache = New System.Net.Cred entialCache
    > cCache.Add(New Uri(strURL), "Basic", New
    > System.Net.Netw orkCredential(" user", "pass", "domain"))
    >
    > ReportWebReques t.Credentials = cCache
    > ReportWebReques t.PreAuthentica te = True
    >
    > Dim ReportWebRespon se As System.net.WebR esponse
    > ReportWebRespon se = CType(ReportWeb Request.GetResp onse(),
    > System.net.WebR esponse)
    >
    > Response.Redire ctLocation = strURL
    > Dim i As Integer
    > For i = 0 To ReportWebReques t.Headers.Count - 1
    > Response.AddHea der(ReportWebRe quest.Headers.K eys(i).ToString (),
    > ReportWebReques t.Headers.Item( i).ToString())
    > Next
    >
    > add code here... ;) what could i make next? response redirect clear the
    > header that i make... i dont know what to do...
    >
    >
    > thanks to all!!![/color]


    Comment

    • Rothariger

      #3
      Re: response.addhea der

      i didnt understand...

      or how can i make the redirect myself?

      "Bruce Barker" wrote:
      [color=blue]
      > a redirect is just a header, you could just do the redirect yourself.
      >
      > -- bruce (sqlwork.com)
      >
      > "Rothariger " <Rothariger@msn .com> wrote in message
      > news:FE935591-B948-4F4C-B103-B2706DE7E3D9@mi crosoft.com...[color=green]
      > > Hello, i have a problem, i must to make a response.redire ct, with a fixed
      > > header (authentication header) but i dont know how to do it... i make
      > > this,
      > > but im stuck here...
      > >
      > >
      > > Dim strURL As String = "http://localhost/webapplication1/webform1.aspx"
      > > Response.ClearH eaders()
      > > Response.ClearC ontent()
      > > Dim ReportWebReques t As System.Net.Http WebRequest =
      > > CType(System.Ne t.WebRequest.Cr eate(strURL), System.net.Http WebRequest)
      > >
      > > ReportWebReques t.Timeout = 10000
      > > ReportWebReques t.MaximumAutoma ticRedirections = 50
      > >
      > > Dim cCache = New System.Net.Cred entialCache
      > > cCache.Add(New Uri(strURL), "Basic", New
      > > System.Net.Netw orkCredential(" user", "pass", "domain"))
      > >
      > > ReportWebReques t.Credentials = cCache
      > > ReportWebReques t.PreAuthentica te = True
      > >
      > > Dim ReportWebRespon se As System.net.WebR esponse
      > > ReportWebRespon se = CType(ReportWeb Request.GetResp onse(),
      > > System.net.WebR esponse)
      > >
      > > Response.Redire ctLocation = strURL
      > > Dim i As Integer
      > > For i = 0 To ReportWebReques t.Headers.Count - 1
      > > Response.AddHea der(ReportWebRe quest.Headers.K eys(i).ToString (),
      > > ReportWebReques t.Headers.Item( i).ToString())
      > > Next
      > >
      > > add code here... ;) what could i make next? response redirect clear the
      > > header that i make... i dont know what to do...
      > >
      > >
      > > thanks to all!!![/color]
      >
      >
      >[/color]

      Comment

      • Rothariger

        #4
        Re: response.addhea der

        hey bruce, i try

        Response.Status = "301 Moved Permanently"
        Response.AddHea der("Location", strURL)


        before the for cicle, and after it, but it makes the same as
        response.redire ct... i need that the IIS get its credentials...



        "Rothariger " wrote:
        [color=blue]
        > i didnt understand...
        >
        > or how can i make the redirect myself?
        >
        > "Bruce Barker" wrote:
        >[color=green]
        > > a redirect is just a header, you could just do the redirect yourself.
        > >
        > > -- bruce (sqlwork.com)
        > >
        > > "Rothariger " <Rothariger@msn .com> wrote in message
        > > news:FE935591-B948-4F4C-B103-B2706DE7E3D9@mi crosoft.com...[color=darkred]
        > > > Hello, i have a problem, i must to make a response.redire ct, with a fixed
        > > > header (authentication header) but i dont know how to do it... i make
        > > > this,
        > > > but im stuck here...
        > > >
        > > >
        > > > Dim strURL As String = "http://localhost/webapplication1/webform1.aspx"
        > > > Response.ClearH eaders()
        > > > Response.ClearC ontent()
        > > > Dim ReportWebReques t As System.Net.Http WebRequest =
        > > > CType(System.Ne t.WebRequest.Cr eate(strURL), System.net.Http WebRequest)
        > > >
        > > > ReportWebReques t.Timeout = 10000
        > > > ReportWebReques t.MaximumAutoma ticRedirections = 50
        > > >
        > > > Dim cCache = New System.Net.Cred entialCache
        > > > cCache.Add(New Uri(strURL), "Basic", New
        > > > System.Net.Netw orkCredential(" user", "pass", "domain"))
        > > >
        > > > ReportWebReques t.Credentials = cCache
        > > > ReportWebReques t.PreAuthentica te = True
        > > >
        > > > Dim ReportWebRespon se As System.net.WebR esponse
        > > > ReportWebRespon se = CType(ReportWeb Request.GetResp onse(),
        > > > System.net.WebR esponse)
        > > >
        > > > Response.Redire ctLocation = strURL
        > > > Dim i As Integer
        > > > For i = 0 To ReportWebReques t.Headers.Count - 1
        > > > Response.AddHea der(ReportWebRe quest.Headers.K eys(i).ToString (),
        > > > ReportWebReques t.Headers.Item( i).ToString())
        > > > Next
        > > >
        > > > add code here... ;) what could i make next? response redirect clear the
        > > > header that i make... i dont know what to do...
        > > >
        > > >
        > > > thanks to all!!![/color]
        > >
        > >
        > >[/color][/color]

        Comment

        • Joerg Jooss

          #5
          Re: response.addhea der

          Rothariger wrote:
          [color=blue]
          > Hello, i have a problem, i must to make a response.redire ct, with a
          > fixed header (authentication header) but i dont know how to do it...
          > i make this, but im stuck here...[/color]
          [...]

          A redirect must be issued from the server-side, but your code runs on
          the client-side. That won't work.

          Cheers,
          --

          mailto:news-reply@joergjoos s.de

          Comment

          Working...