我正在使用这些行从我公司的服务器中获取数据
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = new NetworkCredential(usr, pass);
ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
它工作得很好,但问题是当我发送这样的大 URL 时:
https://172.16.100.1:5002/arx/eventexport?num_events=-1&start_date=1335079800000&end_date=1335382199000&filter=<filter><name><mask>controller.door.closed</mask><mask>controller.notification.digitalOutputChanged</mask><mask>controller.dac.eventBufferOverflow</mask><mask>controller.door.forcedOpen</mask><mask>controller.door.notClosed</mask><mask>controller.door.opened</mask><mask>controller.dac.powerOn</mask><mask>controller.door.pulseOpen</mask><mask>controller.door.pulseOpenRequest</mask><mask>controller.door.requestToExit</mask><mask>controller.reader.duress.alarm</mask><mask>controller.access.card.valid.standard</mask><mask>controller.access.card.invalid.inhibited</mask><mask>controller.access.card.invalid.pin</mask><mask>controller.access.card.invalid.pinMode</mask><mask>controller.access.card.invalid.door</mask><mask>controller.reader.invalid.format</mask><mask>controller.access.card.invalid.operatorControl</mask><mask>controller.access.card.invalid.pinAttempts</mask><mask>controller.access.card.invalid.pinTimeout</mask><mask>controller.access.card.invalid.zone.antipassback</mask><mask>controller.access.card.invalid.time.antipassback</mask><mask>controller.access.card.valid.pin</mask><mask>controller.reader.communicationFailure.active</mask><mask>controller.reader.communicationFailure.restored</mask><mask>controller.intrusionarea.blockingInput.closed</mask><mask>controller.intrusionarea.blockingInput.open</mask><mask>controller.notification.digitalInput1Closed</mask><mask>controller.notification.digitalInput1Opened</mask><mask>controller.dac.input2closed</mask><mask>controller.dac.input2opened</mask><mask>controller.dac.input4closed</mask><mask>controller.dac.input4opened</mask><mask>controller.dac.inputChanged</mask><mask>controller.door.mode.buzzerEnabled</mask><mask>controller.door.mode.conference</mask><mask>controller.door.mode.rteMaintainedUnlock</mask><mask>controller.door.mode.motorlockLowSecurity</mask><mask>controller.door.mode.unlocked</mask><mask>controller.door.mode.access.accessInhibited</mask><mask>controller.door.mode.access.buyAlarmtime</mask><mask>controller.door.mode.access.pinOnlyAllowed</mask><mask>controller.door.mode.access.dualCardsRequired</mask><mask>controller.door.mode.access.pinCardNumber</mask><mask>controller.door.mode.access.modePinRequired</mask><mask>controller.door.mode.access.modeSiteCodeOnly</mask><mask>controller.door.mode.access.apEnabled</mask><mask>controller.door.mode.exit.accessInhibited</mask><mask>controller.door.mode.exit.apEnabled</mask><mask>controller.door.mode.exit.buyAlarmtime</mask><mask>controller.door.mode.exit.dualCardsRequired</mask><mask>controller.door.mode.exit.pinCardNumber</mask><mask>controller.door.mode.exit.pinOnlyAllowed</mask><mask>controller.door.mode.exit.modePinRequired</mask><mask>controller.door.mode.exit.modeSiteCodeOnly</mask><mask>controller.door.motorlock.dayLocked</mask><mask>controller.door.motorlock.initJumperInstalled</mask><mask>controller.door.motorlock.locked</mask><mask>controller.door.motorlock.nightLocked</mask><mask>controller.door.motorlock.tubTurned</mask><mask>controller.door.motorlock.unlocked</mask><mask>controller.door.motorlock.error.encryptionFault</mask><mask>controller.door.motorlock.error.failedToLock</mask><mask>controller.door.motorlock.error.failedToUnlock</mask><mask>controller.door.motorlock.error.problemAtLock</mask><mask>controller.door.motorlock.error.problemAtPermanentUnlock</mask><mask>controller.door.motorlock.error.problemAtUnlock</mask><mask>controller.door.motorlock.error.seriousProblemAtLock</mask><mask>controller.notification.powerFault.active</mask><mask>controller.notification.powerFault.restored</mask><mask>controller.reader.tamper.active</mask><mask>controller.notification.tamper.restored</mask></name></filter>
我得到了这个例外
{“远程服务器返回错误:(414) 请求 URI 太大。”}
在这一行:
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
那么如何使用 HttpWebRequest 发送大型 URI?
提前致谢