C#: Parse UserAgent Into HttpCapabilitiesBase?
Jan 5, 2011
Is there anyway to parse an useragent string into an HttpCapabilitiesBase object? (this is what you get from (HttpRequest)request.Browser).
If not is there any other good way to parse useragent string in .NET.
View 1 Replies
Similar Messages:
Oct 7, 2011
To detect if a mobile device is browsing to the website, I found I could do something like this:
Code:
Request.UserAgent.ToString().ToLower().Contains("droid"))
And I would need to check for other values such as blackberry, iphone, etc. My question is that I assume I would need to make the home page an aspx page right? Right now it is an html page so I would need an aspx page to check and redirect according to the value?How many people use this method to detect mobile? I have already tested the IsMobileDevice method and that was not correct with many devices.
View 2 Replies
Feb 3, 2011
I'm building a mobile expansion on my company website that will redirect users to a mobile version of the site at login if my code detects if they're using a mobile device. I've tried using things like Request.IsMobileDevice (which sounded too good to get true to begin with) but it doesn't seem to work at all. So after looking through some of my browser detection options, I've decided to reference Request.UserAgent to find out what people are using.
So I'm using this for mobile detection:[Code]....
I've looked up what the UserAgent value is for Windows Phone 7, which is why I'm checking for "IEMobile", but I'm not sure if this will be solid enough."> Could someone let me know what the Request.UserAgent values are for some of the major mobile browsers (IPhone, Android, Blackberry, etc.)?If someone would happen to know what it is for Apple users against Safari and Firefox would be great too.
View 2 Replies
Jun 30, 2010
we are trying to use google to get exchange rate prices.
they use a csv file which we get the code to go out and get.
what im trying to do is pick the first line of the file and just use that. i have the following code but its not just picking the one line.
[code]....
View 3 Replies
May 23, 2010
I can use the TextFieldParser Class to parse the text of a file in the file system (given the abslolute path) but it won't parse text from a file whose location is identified by a URI.
View 8 Replies
Jan 27, 2010
The question is not really about parsing the HTML, but rather parsing the HTML and adding elements to the DOM according to the HTML tags. For example - I want to be able to take an HTML page, add attribute to the HTML tags - such as "class='replace'", put some PHP/ASPNET code in the page (make an ASPX page with ASPNET or put some include with PHP) and make them parse the page every time it is accessed and manipulate the DOM of the tags marked as 'class="replace".
For example if I have < div class='replace'>< /div>, after I run the script I'll get something like < div class='replace'>This is a new text< /div>
View 2 Replies
Oct 6, 2010
Given a time: 1286294501433Which represents milliseconds passed since 1970, how do we convert this to a DateTime data type? EG:
transactionTime = "1286294501433";
UInt64 intTransTime = UInt64.Parse(transactionTime);
DateTime transactionActualDate = DateTime.Parse(intTransTime.ToString());
Throws: String was not recognized as a valid DateTime.Please note all times passed into this function are guaranteed to be after 1970.
View 2 Replies
Dec 16, 2010
Where I live the local transport service has this page where you can read about delays and disturbances in the traffic. I would like to parse this page so I can store this data and make a nice report of it.
The problem is that to be able to get the information you need to submit a form by making some choices and clicking a button. You can't just visit the page.
How can I get the information "behind" the form from code so that I can parse it?
View 5 Replies
Jul 22, 2010
I want to get the text of an html page using a simple application in c#?If there are nested elementsie.,
<Table>
<TR>
<TD>**ABC**
[code]...
View 1 Replies
Apr 16, 2010
have content html and put it into s variable
[code]....
Any one show me way to get each row in above table and push it into string array ?
View 10 Replies
Nov 7, 2010
I want to parse an address from a text field. for example
textbox data = 123 test street, mountain view, CA 91302
Dim address = Address.text
parse(address)
to
Address1
Address2
City
State
Zip
I found someones sample code, but it doesn't work all that well. here it is non the less
Public Function parseAddress(ByVal input As String) As Collection
input = input.Replace(",", "")
input = input.Replace(" ", " ")
Dim splitString() As String = Split(input)
Dim streetMarker() As String = New String() {"street", "st", "st.", "avenue", "ave", "ave.", "blvd", "blvd.", "highway", "hwy", "hwy.", "box", "road", "rd", "rd.", "lane", "ln", "ln.", "circle", "circ", "circ.", "court", "ct", "ct."}
Dim address1 As String
Dim address2 As String = ""
Dim city As String
Dim state As String
Dim zip As String
Dim streetMarkerIndex As Integer
zip = splitString(splitString.Length - 1).ToString()
state = splitString(splitString.Length - 2).ToString()
streetMarkerIndex = getLastIndexOf(splitString, streetMarker) + 1
Dim sb As New StringBuilder
For counter As Integer = streetMarkerIndex To splitString.Length - 3
sb.Append(splitString(counter) + " ")
Next counter
city = RTrim(sb.ToString())
Dim addressIndex As Integer = 0
For counter As Integer = 0 To streetMarkerIndex
If IsNumeric(splitString(counter)) _
Or splitString(counter).ToString.ToLower = "po" _
Or splitString(counter).ToString().ToLower().Replace(".", "") = "po" Then....
[Code...]
View 1 Replies
Mar 24, 2011
I just uploaded files to my website and am getting a parser error when it comes to the Inherits word. If the exact error , you can look at [URL] the required dll is located at [URL] if it i got the web host godaddy sells. Also I thought it would be worth noting that if I remove the Inherits from the page there is no error.
View 1 Replies
Sep 27, 2010
I'd like to know one (or more) ways to parse the HTML page output. I'd like to detect some patterns on the HTML that will be send to the client and log some info if present.
View 2 Replies
May 2, 2010
i have an html (save in a string variable if needed) and i want to use the content of one of the html's tables (the html page has 4 tables an i want only one of them) . i read a lot of similar post but i didn't find anything helpful. on how to parse the html and get the content of one of the tables so i can use this data later?
View 5 Replies
Jan 10, 2011
I have a String that contains the following: ?workarea=London+&+Home+Counties+Ltd&sub=fs&&&FASh*5which resembles a URI query string. What is the best way to parse the elements of this string (workarea and sub) without messing about with string manipulation?If I use HttpUtility.ParseQueryString is gets stuck as both elements include &. However if I encode the whole thing first I lose the seperations of the elements. Ideally the output would be:workarea = London & Home Counties Ltdsub = fs&&&FASh*5
View 4 Replies
Oct 13, 2010
I have a ListBox on my page. I'm making an AJAX call to a C# function, and I need to pass the values of the selected items. Here's what I have:
$('#btnSubmit').click(function() {
$.ajax({
type: "POST",
url: 'Default.aspx/GetSelectedValues',
data: '{selectedValues: ' + $('#lbItems').serialize() + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess
});
});
<select id="lbItems" multiple="multiple">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
<option value="5">Five</option>
</select>
[System.Web.Services.WebMethod]
public static string GetSelectedValues(string selectedValues)
{
//
}
The data being passed to the C# function looks like:
lbItems=1&lbItems=3&lbItems=5
Is there any built-in C# function that can deserialize that easily, to convert the values into an array of some sort? Or maybe there's a better way to pass the data from jQuery?
View 3 Replies
Jan 4, 2010
I am trying to parse out the date in datetime function. For example, I have 1/2/2010 and would like to parse out the day, month and year into different variables.
sDatetime = 1/2/2010
sDay = 1
sMonth = 2
sYear= 2010. Also I would like the day to be shown as 01 not just "1".
View 1 Replies
Sep 14, 2010
For my ASP.Net application I need to use a HTTP REST API that returns a JSON object.Here's how the JSON looks:
message: [
{
type: "message"
href: "/messages/id/23"[code]....
I could use the DataContractJsonSerializer Class and have custom Classes defined. However, am not sure how keys like "$" would get converted to in .Net.
View 3 Replies
Jan 26, 2011
Whats the main difference between int.Parse() and Convert.ToInt32
What is better to use int.Parse or Convert.toInt? which one is more error prone and performance vice good?
View 4 Replies
Apr 4, 2013
Below is XML response from my vendor.
For Each i need <ns1:PricedItinerary> Node there exists a <formdata> node and i need to get that formdata node datas alone and append to my next request..
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:OTA_AirLowFareSearchRS Version="2.001" xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:ns1="http://www.opentravel.org/OTA/2003/05">
<ns1:Success />
[Code] ....
View 1 Replies
Jan 10, 2011
Hope this is the right forum to ask. I am trying to write a simple mobile application with two form fields that POST to a webservice that queries an SQL database and comes back with an XML file that needs to be parsed and displayed
properly in a browser.
So what I have is a webservice .asmx file that is working properly and an HTML form that POST two variables to the webservice file. The result is the generated XML. I simply just need to know the simplest way to display parts of that data as output within the
design of the form page.
Here is the HTML form: http://www.bt4u.org/
And here is the web service: http://www.bt4u.org/BT4U/BT4U_WebService.asmx
If you enter in the following respectively you will see the XML file:
MSS-1607
HWD-2104
there is some sort of class that stores the XML in an array or some such thing that can then be manipulated
View 2 Replies
Feb 15, 2010
I am creating a web app in ASP.NET with VB code behind. I would like it so that a user can input a url ("[URL]") and then when the user presses the GO button, I want the system to interprete the [URL] page (without navigating to it), look in the HTML source, and store all data that is present within the URL's <p></p> tags...is this possible?
I have noticed a similar thing present on [URL]. When you submit an article to [URL], it automatically looks at the URL's <meta name="description" content="" /> in the URL HTML file. I would like to do a similar thing, but instead extract all text between all <p></p> tags.
View 3 Replies
Mar 8, 2010
Is there a way to easily split a comma delimited string into variables (or table fields), example:
PHP Code:Feed.SmulocV2.Equipment,CAT,,DFT08783,2567,Hours,2010-02-07 06:37:41,Lat:38.025921,Lng:-88.776733
View 5 Replies
Aug 3, 2010
I need to programmatically parse and transform ASP.NET webform pages. It's a requirement that I have =(.
Anyone know any tools or frameworks?
Update:
I just need to modify ASPX pages (not rendered HTML code).
There are no inline c# code.
View 1 Replies
Mar 29, 2011
Exploring the feasibility of something here... We have a UI page in the mvc3 web-application that the admin will use to upload a 'csv' file. Is it possible to have an SSIS package that will be called by the application..that will validate/transform all these data and store into db if its all valid or throw back error details to application if there are invalid data?
Just trying to leverage the capabilities of SSIS to do the parsing of file and transformation of data. If this is not possible, is there a better way?
update: yes, need to execute ssis on the fly.. and give back a message on the UI page. telling the'uploader' if his upload failed or not based on message that SSIS would give back to the application.
View 4 Replies