小编Rup*_*dav的帖子

ASP.NET - 如何在/之前删除查询字符串?从ASPX参数传递?

我想解析aspx页面中的值,两者之前传递的是什么?之后呢?那么,什么是允许我解析出来的C#函数呢?

我想做的事情如下:

var pageType = parameter.trimBefore?();

var pageString = parameter.trimAfter?();
Run Code Online (Sandbox Code Playgroud)

谢谢你的建议.

c# asp.net

0
推荐指数
1
解决办法
1113
查看次数

尝试在xcode中创建类的对象时出现EXC_BAD_ACCESS错误

当我尝试创建方法的实例时,我收到EXC_BAD_ACCESS错误.

UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(40,38,240,203)];
DetailImageViewDataSource *detail=[[DetailImageViewDataSource alloc] init];//**error line**

@implementation DetailImageViewDataSource


@synthesize webdata,xmlParser,soapResults,newImage;
-(void) startParsing
{
    recordResults=FALSE;
    NSString *soapMessage=[NSString stringWithFormat:
                           @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                           "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
                           "<soap:Body>\n"
                           "<GetImage xmlns=\"http://tempuri.org/\">\n"
                           "<imageID>f89df9ad-5a5d-4354-895f-356d8ce4ccfb</imageID>\n"
                           "</GetImage>\n"
                           "</soap:Body>\n"
                           "</soap:Envelope>\n"];


//http://192.168.2.7/ImageWebService/Service1.asmx
//http://192.168.2.7/ThesisWebServicesNew1/Service.asmx
NSLog(soapMessage);
NSURL *url=[NSURL URLWithString:@"http://192.168.2.7/ThesisWebServicesNew1/Service.asmx"];
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:url];
NSString *msgLength=[NSString stringWithFormat:@"%d",[soapMessage length]];

[theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue:@"http://tempuri.org/GetImage" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];

NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

if(theConnection)
{
    webdata=[[NSMutableData data] retain];

    NSLog(@"got connected");
}

else
{ …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c

0
推荐指数
1
解决办法
1768
查看次数

要为无法识别的ID参数抛出什么异常类型?

ITool GetTool(Guid tool)
{
    if (tool == Hammer.Id)
        return new Hammer();
    else if (tool == Drill.Id)
        return new Drill();

    else
        throw new ....?
}
Run Code Online (Sandbox Code Playgroud)

扔在这里最合适的异常类型是什么?NotSupportedException是我发现的最接近但我不认为这是正确的.

.net c# exception

0
推荐指数
1
解决办法
273
查看次数

如何从googleapis考虑位置的纬度和经度

我使用"http://maps.googleapis.com/maps/api/geocode/xml?address="+address+"&sensor=true"来获取某个位置的纬度和经度.从这个我得到如下响应:

<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>locality</type>
  <type>political</type>
  <formatted_address>Chicago, IL, USA</formatted_address>
  <address_component>
   <long_name>Chicago</long_name>
   <short_name>Chicago</short_name>
   <type>locality</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Cook</long_name>
   <short_name>Cook</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Illinois</long_name>
   <short_name>IL</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>United States</long_name>
   <short_name>US</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <geometry>
   <location>
    <lat>41.8781136</lat>
    <lng>-87.6297982</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>41.7450495</lat>
     <lng>-87.8859170</lng>
    </southwest>
    <northeast>
     <lat>42.0109012</lat>
     <lng>-87.3736794</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>41.6443350</lat>
     <lng>-87.9402669</lng>
    </southwest>
    <northeast>
     <lat>42.0231310</lat>
     <lng>-87.5236609</lng>
    </northeast>
   </bounds>
  </geometry>
 </result>
</GeocodeResponse>
Run Code Online (Sandbox Code Playgroud)

响应具有许多位置的lng和lat值.那么我要考虑哪一个?

google-maps latitude-longitude weather-api google-maps-api-3 google-weather-api

0
推荐指数
1
解决办法
638
查看次数