Friday, March 16, 2012

Medium trust blocks simple URL posting

I am trying to do a URL post using HttpWebRequest, but it fails because I am hosting on Network Solutions, and their servers are all medium trust. Apparently HttpWebRequest doesn't work on medium trust.

Is there any way to do URL posting in a medium trust environment? I'm hoping I don't need to switch hosts because of this.

Since it's a shared host, I don't have access to machine.config, and I can't add the <trust> tag to web.config since allowOverride was set to false by the host. I've already called two other hosting companies and apparently they are also medium trust, does that mean half of asp.net functionality is never going to be allowed anymore??

Thanks in advance,
Amit

I describe a posting approch by redirecting to an HTML page here:

http://forums.asp.net/thread/1520295.aspx


There are several drawbacks to the approach you are describing.

First of all, you cannot read back from that page, which is exactly what I need to do because they are going to be giving back a success or failure message.

Second of all, I want to do it behind the scenes so nobody sees what's going on...I want to do it in the code behind C#. I am using the HttpWebRequest class to make this happen, but it is blocked by medium trust.

Is there a way to do this?

Thanks,
Amit


How do you want to give result back?

if by post back then in that post i describe it?

if another approach you want to give result , what's the approach?


Okay let me describe this better...

I am talking to another site...I have to send them some parameters, and then I have to read that page to see if it was a success or failure so that I can do the appropriate business logic. I want to do this behind the scenes so nobody sees this is going on.

The way I am doing this is by doing an HttpWebRequest (programmatically opening their webpage -- and passing the right query parameters)....this is normally successful for me. I am only running into a problem recently because of medium trust. All shared hosts are now running on medium trust. HttpWebRequest is not allowed in medium trust.

I am trying to find out if there is a way to do this in medium trust that I don't know of...or some alternate method. I know of how to do a simple html post that you are describing, but it is not going to be adequate for what I want to do....at least I don't think it is.

Thanks,
Amit


I think there is no other way than this two approach, also a third approach can be using WebService if destination support it.
I believe WebService is also blocked my medium trust.
So there is no other way i think!
So basically there is no way to do url posting in medium trust? Is that the conclusion we've come up with?...besides doing html posting through regular old html....but certainly no asp.net technique?

0 comments:

Post a Comment