response.addheader

G

Guest

Hello, i have a problem, i must to make a response.redirect, 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.ClearHeaders()
Response.ClearContent()
Dim ReportWebRequest As System.Net.HttpWebRequest =
CType(System.Net.WebRequest.Create(strURL), System.net.HttpWebRequest)

ReportWebRequest.Timeout = 10000
ReportWebRequest.MaximumAutomaticRedirections = 50

Dim cCache = New System.Net.CredentialCache
cCache.Add(New Uri(strURL), "Basic", New
System.Net.NetworkCredential("user", "pass", "domain"))

ReportWebRequest.Credentials = cCache
ReportWebRequest.PreAuthenticate = True

Dim ReportWebResponse As System.net.WebResponse
ReportWebResponse = CType(ReportWebRequest.GetResponse(),
System.net.WebResponse)

Response.RedirectLocation = strURL
Dim i As Integer
For i = 0 To ReportWebRequest.Headers.Count - 1
Response.AddHeader(ReportWebRequest.Headers.Keys(i).ToString(),
ReportWebRequest.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!!!
 
B

Bruce Barker

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

-- bruce (sqlwork.com)
 
G

Guest

hey bruce, i try

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


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

Joerg Jooss

Rothariger said:
Hello, i have a problem, i must to make a response.redirect, with a
fixed header (authentication header) but i dont know how to do it...
i make this, but im stuck here...
[...]

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

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,142
Latest member
arinsharma
Top