-1

I have two separate websites. The main site requires a login. A menu on my website should redirect the user to a different website and pass to it the username of the logged in user. I have the following code:

Main website (sending):

using (var client = new WebClient())
{
    var values = new NameValueCollection();
    values["user"] = Session["UserName"].ToString();
    client.UploadValues("http://spsrv02:93/", values);
}

Other website (receiving):

string value = Request.Form["user"];

I am getting this error: "ERR_TOO_MANY_REDIRECTS"

Please help. What am I doing wrong?

P.S I don't want to go through URL parameters since I will have to encrypt/decrypt the data and I don't want to get into that whole cryptography deal.

I tried debuggin with VS but I can't redirect to a local running IIS page

5
  • Which website is redirecting (presumably in a loop)? The website to which this code is sending data, or the website which hosts and invokes this code? I don't see anything here that involves a redirect in any way. It's also worth noting... "should redirect the user to a different website" - That's not what this code is doing at all. This code is making an HTTP request to a website/API, it's not directing the user to do that. "since I will have to encrypt/decrypt the data" - It's not clear whether you want this request to come from the user or from your application, can you clarify?
    – David
    Commented Jul 8 at 13:33
  • This is the scenario: I have two independent websites A and B, I want to pass some text from website A to website B without passing it in the URL. So I have used to code above. But when site B loads it goes into this infinite redirect. Commented Jul 8 at 15:07
  • "But when site B loads it goes into this infinite redirect." - Do you mean specifically when you invoke the URL http://spsrv02:93/ in the code above? Or when redirecting the user to "Site B" after the code above has executed? Or something else? In either case, if the code shown above is on "Site A" and you're having an issue with "Site B" then wouldn't you want to examine and debug that code, not this? It's not really clear what specific problem you're observing or what specific operation is failing.
    – David
    Commented Jul 8 at 15:20
  • I figured the problem and I am not getting a redirect error anymore. Now the problem is I am not getting the value I am passing to the second site. Commented Jul 9 at 5:15
  • If you're not planning to update the question to provide any information about the problem then you are encouraged to delete the question.
    – David
    Commented Jul 9 at 11:59

0

Browse other questions tagged or ask your own question.