RE: Server page to page addressing
am 02.04.2008 19:14:01 von NeilBPeter,
Using the absolute address works.
Now that I can get to the page I want I can't get to the data I passed it.
In the Page_Load (....) method, of the target page, I try to get the
collection of name/value data that I passed it. The information is in the
Request.Parms okay but the instruction below that I used leaves the NameValue
Collection empty. At least as best I can determine its empty. Everything I
saw was 0 or null.
NameValueCollection coll = Request.QueryString;
The data in the Request.Parms follows. I'm only using the first 3 Name/Value
pairs the rest was added by the POST from the source page.
Any idea why the Request.QueryString instruction fails to fill the
collection???
Thanks, Neil
{%3fCommand=Register&Name=NBARTOW&Password=11111111&ALL_HTTP =HTTP_CONNECTION%3aKeep-Alive%0d%0aHTTP_CONTENT_LENGTH%3a48% 0d%0aHTTP_CONTENT_TYPE%3aapplication%2fx-www-form-urlencoded %0d%0aHTTP_EXPECT%3a100-continue%0d%0aHTTP_HOST%3alocalhost% 3a50210%0d%0a&ALL_RAW=Connection%3a+Keep-Alive%0d%0aContent- Length%3a+48%0d%0aContent-Type%3a+application%2fx-www-form-u rlencoded%0d%0aExpect%3a+100-continue%0d%0aHost%3a+localhost %3a50210%0d%0a&APPL_MD_PATH=&APPL_PHYSICAL_PATH=C%3a%5cActBo oks+Web+Dev%5c&AUTH_TYPE=NTLM&AUTH_USER=NEIL5%5cNeil5&AUTH_P ASSWORD=&LOGON_USER=NEIL5%5cNeil5&REMOTE_USER=NEIL5%5cNeil5& CERT_COOKIE=&CERT_FLAGS=&CERT_ISSUER=&CERT_KEYSIZE=&CERT_SEC RETKEYSIZE=&CERT_SERIALNUMBER=&CERT_SERVER_ISSUER=&CERT_SERV ER_SUBJECT=&CERT_SUBJECT=&CONTENT_LENGTH=48&CONTENT_TYPE=app lication%2fx-www-form-urlencoded&GATEWAY_INTERFACE=&HTTPS=&H TTPS_KEYSIZE=&HTTPS_SECRETKEYSIZE=&HTTPS_SERVER_ISSUER=&HTTP S_SERVER_SUBJECT=&INSTANCE_ID=&INSTANCE_META_PATH=&LOCAL_ADD R=127.0.0.1&PATH_INFO=%2fClientDbQuery.aspx&PATH_TRANSLATED= C%3a%5cActBooks+Web+Dev%5cClientDbQuery.aspx&QUERY_STRING=&R EMOTE_ADDR=127.0.0.1&REMOTE_HOST=127.0.0.1&REMOTE_PORT=&REQU EST_METHOD=POST&SCRIPT_NAME=%2fClientDbQuery.aspx&SERVER_NAM E=localhost&SERVER_PORT=50210&SERVER_PORT_SECURE=0&SERVER_PR OTOCOL=HTTP%2f1.1&SERVER_SOFTWARE=&URL=%2fClientDbQuery.aspx &HTTP_CONNECTION=Keep-Alive&HTTP_CONTENT_LENGTH=48&HTTP_CONT ENT_TYPE=application%2fx-www-form-urlencoded&HTTP_EXPECT=100 -continue&HTTP_HOST=localhost%3a50210}
"Peter Bromberg [C# MVP]" wrote:
> The tilde ("~") does not work with WebRequest / WebClient because they expect
> a fully qualified url to work with. So
> "http://" + ConfigurationManager.AppSettings["siteHost"]
> +"/clientDBQuery.aspx";
> would be one alternative where you can store the siteHost element in your
> appSettings web.config section on a per-site basis.
> -- Peter
> Site: http://www.eggheadcafe.com
> UnBlog: http://petesbloggerama.blogspot.com
> Short Urls & more: http://ittyurl.net
>
>
> "Neil B" wrote:
>
> > I'm developing a Web App using C#. I want a page in the app to refer to
> > another page in the app. I tried to create a web request with the page
> > address below:
> >
> > pageAddress = "http://~/clientDBQuery.aspx";
> > WebRequest request = WebRequest.Create (pageAddress);
> >
> > and got the following error:
> >
> > Exception Details: System.UriFormatException: Invalid URI: The hostname
> > could not be parsed.
> >
> > What is the syntax for referring to a page on the current site so I don't
> > have to change it when it's published?
> >
> >
> > When I used the following page address:
> >
> > pageAddress = "http://clientDBQuery.aspx";
> >
> > I didn't get the parsing error but the debugger didn't stop on a break point
> > I set in the LoadPage method. This seems to occurr because it goes to a page
> > on my ISP which doesn't exist.
> >
> > What's the right way to handle this situation?
> >
> > Thanks, Neil