Web Forms :: Determining User Agent From A Collection?
Aug 19, 2010
I am currently using Request.Useragent.Contains("string1") and if string1 matches with my useragent i am writing it on to the page, now I have to check with a collection ( array or list or ..) which contains {"string1","string2","string3"} and Response.write the useragent if the Request.useragent contains any of the strings collection (string 1,2,3). I am unable to detemine this and if i use a list or array, i am getting a "cannot convert from string[] to string" exception when i use it with Request.Useragent.Contains.
If there is a better way of achieving this, let me know. Its important.
View 2 Replies
Similar Messages:
Jul 9, 2010
I perform a httpwebrequest without setting the useragent property.The page where I send my request to response with [Code]....
View 3 Replies
Jun 7, 2010
I need to generate small images for certain parts of text. Those will have to fit into the text seamlessly. I know I can not make up for every browser font settings available, but how do I have to check for Linux, Mac and Windows users depending on the user agent? I want to use the right font (of the three "Verdana, Arial, Helvetiva") for the right user agent OS.
So:How do I check for the OS? What do I have to compare to in the user agentWhere can I get the other two fonts. Does the Windows-included Verdana look the same as the one used on Linux (or, is it free anyway? I don't know much about fonts)? Where do I get Helvetica? Is it Mac OS licensed?
Any code examples can be in either c# or VB.NET. I can read both.
View 2 Replies
Feb 3, 2010
For the user agent string
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)
HttpContext.Current.Request.Browser.MajorVersion returns 3 and HttpContext.Current.Request.Browser.MinorVersion returns 5. So far so good.
However for this user agent string (seen in the wild by one of my users)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 (CK-Finbu.com) Firefox/3.6 (.NET CLR 3.5.30729)
HttpContext.Current.Request.Browser.MajorVersion returns 1 and HttpContext.Current.Request.Browser.MinorVersion returns 9. It looks like ASP.NET has picked up the numbers from the CVS tag info rather than the browser version. Does this mean that ASP.NET's user agent parsing is broken?
View 1 Replies
Apr 20, 2010
When making a call to a SOAP web service how does one go about adding a user agent string to the request from a SOAP client?
View 1 Replies
Mar 9, 2011
I am currently developing a site for my OJT.I have created a login form for my site now I got confused on what to do with this one. I need to identify if the user has been log-in or log-out As the user inputted the exact username and password it will go to this line of codes in which will identity if the user has bees signout or not.
HttpCookie cookie = new HttpCookie("isLog");
cookie.Value = "1";
DateTime dtNow = DateTime.Now;
TimeSpan tsMinute = new TimeSpan(1, 1, 0, 0);
cookie.Expires = dtNow + tsMinute;
Response.Cookies.Add(cookie);
Response.Redirect("manageService.aspx");
And I have this function to determine if the user has been log-in or log-out.
protected Boolean isLog()
{
//String strCookieName = Request.QueryString["cookie"].ToString();
//Grab the cookie
HttpCookie cookie = Request.Cookies["isLog"];
String tmp = cookie.Value.ToString();
return (tmp != null);
}
Now, my problem here is that even though I inputted the correct username and password after reloading the page it will still asked for the user name and password(sends me to the login page). I already set a value for the "isLog" cookie but still it return a wrong info.
View 1 Replies
Dec 8, 2010
I am trying to create a web application that shows a list of events for different users. I have 2 different user 'roles': admin and member.
Is there a way of getting the current logged in users role? i have tried:
[Code]....
But it doesnt seem to be catching the certain user types, it always shows all of the events.
View 4 Replies
Aug 17, 2010
Currently, I'm just using clientside Javascript (location.href), but I am wondering if there is a way in Asp.Net to figure out the URL the user originally entered (assume I did not change it myself via 301), or at least to track it in a simple and reliable manner. As I am using my own implementation of URL rewriting via the global.asax (e.g. Context.RewritePath), this is not an easy task, particularly since I don't want to touch it too much.
Example
Global.asax:
public override void Init()
{
base.Init();
this.BeginRequest += new EventHandler(Global_BeginRequest);
}
void Global_BeginRequest(object sender, EventArgs e)
{
if (VARIOUSCONDITIONS) Context.RewritePath("SOMEURL");
}
SomePage.aspx.cs
protected void Page_Init(object sender, EventArgs e)
{
//Request.RawUrl is equal to "SOMEURL", as
//are other properties that store the URL.
}
View 1 Replies
Apr 28, 2010
I'm dynamically loading a user control from a for loop against a objects collection, eg.
[code]....
I want to pass the following collection into the user control: oPerson.Address[i].listHistory (listHistory is a List of objects which I want to manipulate inside the usercontrol)
How can I pass this into the usercontrol so i can do this
View 10 Replies
Jul 26, 2010
I have a list of objects that I want to bind to a gridview. Creating that list and binding it works fine for most of the public properties in that list.
There are some objects contained in each of those objects... for instance there is an Address object.
object.Address.Line1;
object.Address.Line2;
When I bind this to my gridview, I have no issues with stuff like object.DateRegistered, but how can I access things like object.Address.WhatEverProperty? I always get this error:
"A field or property with the name 'xxx.xxxx' was not found on the selected data source."
View 7 Replies
Mar 31, 2010
I want to know that how i use the collection class for storing some data and save it letter in the data base.
View 4 Replies
Jun 10, 2010
I created user control. It has string[] public property (it may be List<string> or whatever). I want to support defining this property in aspx code, when declaring the instance of this usercontrol. Something like this:
<uc1:MyControl ID="MyControl1" runat="server">
<MyStringCollectionProperty>
<string>My String 1</string>
<string>My String 2</string>
[code]...
View 3 Replies
Jan 29, 2010
I'm using forms authentication in my C# based web site, with the authentication defined in web.config files in the various folders/sub-folders. I want to write a generic administration menu system, that lists all of the admin pages that the use is authorized to open. As I add pages, I want them to automatically show up in the menu. I need to obtain a list/collection of all pages that the active user is authorized to open. Is this possible in ASP.Net 3.5?
View 2 Replies
Aug 9, 2010
I know how to do this in a datatable but I would just like to learn how to do it in a dataview.
I have a dataview which is used to populate a gridview. It has the following column
userid Location
123 New York
124 Chicago
125 London
Now, I would like to know how to determine the 124 row and highlight it to a blue in a dataview used to populate a gridview. kindly note, i can do this in a datatable but not a dataview. I would like to learn how to do it in a dataview.
View 6 Replies
Aug 25, 2010
i'm using a gridview and has a column of checkbox that is within a template field.
I want to do it in C# but I only found this code in VB
[Code]....
View 3 Replies
Aug 12, 2010
I'm using ling2sql to display the record with the record ID that's in the querystring. I want to get the previous and next records in the table. What is the simplest way to do that? Is there a way to determine that the current record is the nth record in the table?
View 6 Replies
Jun 25, 2010
Start Sql Agent Job from Website Can this be done in VB?
View 2 Replies
May 4, 2010
Well I would like to get understanding on sql server security. how to map windows user eg:'srm123' to sql server agent so that user when logins in sql server can also work with sql server agent.bydefault u can not see sql server aqent icon in ssms in userlogin.what is a role of a proxy and credentials how to map them with windows user to workwith jobs and alerts.
View 1 Replies
Jan 12, 2011
I am trying to run a Stored Proc in 2008 using the sql agent. I read some posts on here and other places that say you can and I have tried what they said but isn't running. I can execute the proc form a query window and its working fine so its not my proc.I setup a job and then created a step named the step run stored procType: not sure here but I left it at default T-SQLChanged the database to the database where my sp is located Then in command i put exec dbo.sp_myprocname
View 2 Replies
Oct 15, 2010
I am facing grouping the agent wise in stored procedure, here i showned the table columns,views and stored procedures i used.
User Table columns
User_Id,pwd,Created_Dttm,Role,Status
Table1 columns[code]....
Problem is when i am group by A.Name i am getting error "Column 'V1.Target' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."
View 1 Replies
Oct 11, 2010
I have a solution that was originally created using VS 2008. I have quite a few unit tests that all passed when ran in VS 2008.
Yesterday I opened this solution in VS 2010 and converted it using the wizard. The solution built just fine, it runs just fine, BUT now all tests that access the db fail. I get the same error on every test (below).
"The runtime has encountered a fatal error. The address of the error was at 0x5b3b5ad7, on thread 0x19a4. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack."
In test classes that use ClassInitialize() and ClassCleanup() methods, all the tests fail. All tests fail with the same error, "The agent process was stopped while the test was running." Tests in test classes that do not utilize ClassInitialize() and ClassCleanup() (these tests do not hit the database) all pass.
When this was a VS2008 project all 153 tests passed. No changes have been made to these tests, other than converting the project to a VS2010 project.
I've been playing around with one test class. I commented out the ClassInitialize() and ClassCleanup() methods. I rewrote one test method and mocked everything. I tried running just that one test. I still got the "The agent process was stopped while the test was running" error.
Visual Studio 2010, version 10.0.30319.1 RTMRel
Test framework: integrated VS 2010 MS Test
Mocking framework: Not using mocking, I have a db that is destroyed and recreated in MyClassInitialize(), it is populated with known values. Yes, I know I should be using mocking, but this is an older app and it has not been updated with all of the new bells and whistles yet.
DB Framework: NHibernate
Target Framework is 3.5 for all projects in this solution except for the test project.
The target framework is 4.0 for the test project. I tried changing it to 3.5, it will not let me.
"Attempted re-targeting of the project has been canceled. You cannot change the specified .NET framework or profile for a test project."
View 4 Replies
Mar 25, 2011
I have an ASP.NET app with lots of textboxes all over the page that need updating at various points through program execution.
These textboxes actually belong to a certain class, so for easy updating I thought I could create a Dictionary(Of string, object) and add the control.ID and the control to it and then for updating do something like this:
(in case of updating textbox.text):
[code]....
However the text property of the textbox does not actually get updated. I'm mainly trying to avoid having to manually do textbox.text = somestring for each one of my textboxes every time I have to update them.
View 3 Replies
Oct 26, 2010
I have a textbox where the enduser will type either a customer number (int) or a lastname, firstname and press a submit button. I need to programatically determine whether the text field of the textbox can be parsed as an int - and if so, process methodThis or if it is a string, process methodThat.
[Code]....
View 3 Replies
Apr 20, 2010
I have setup a job in SQL Server Agent which run a store procedure.
[Code]....
After the job excuted, the temp table have not been created.
If I type "exec data_syn_ClearAllEposData". The temp table has been created.
Global Temp table cannot create in SQL SERVER AGENT?
View 8 Replies
Feb 10, 2011
I am unsure how to quickly check a set of returned values for a specific value. Given the following:
[Code]....
I then want to check all the returns values in locs for a specific value. I know I could build a foreach loop that would walk through every return data value in locs to see if it matched, but I was hoping to use something simpler.
[Code]....
I tried to search for this already as I am sure it has been asked before, but I apparently lack the proper search keywords.
View 2 Replies