As part of our app, user can save some data as XML on server which becomes RSS feed for them. Now some of the file user created have & in file name as BB&T_RSS.xml. So when user point this to [URL], they won't get his. I tried BB%26T.xml, BB&T.xml without any success with IE, Chrome
I have the need to add a javascript include to my ASP.NET page. The url of the javascript file has two key/value pairs in the query string. But the ampersand is being escaped and I don't want that.
Page.ClientScript.RegisterClientScriptInclude("myKey", "https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1") This results in the following HTML: <script src="https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1" type="text/javascript"></script> But what I really want is: <script src="https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1" type="text/javascript"></script>
I have a server control that needs to programmatically inject a JavaScript reference into the page. It is to reference Microsoft's Bing map control which requires &s=1 to be appended to the script URL for use over SSL. The problem is that the .NET Framework encodes the attributes and changes the & to an & (verified with Reflector). At some point after that the & is removed altogether.
Desired script tag: <script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1"> </script> Attempt 1: var clientScriptManager = this.Page.ClientScript; if (!clientScriptManager.IsClientScriptIncludeRegistered(this.GetType(), "BingMapControl")) { clientScriptManager.RegisterClientScriptInclude( this.GetType(), "BingMapControl", "https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1"); } Attempt 2: HtmlGenericControl include = new HtmlGenericControl("script"); include.Attributes.Add("type", "text/javascript"); include.Attributes.Add("src", "https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1"); this.Page.Header.Controls.Add(include);
However the companyid is a text string and the company may have an "&" in it which I know will truncate the string. I have seen that this can be overcome by using "UrlEncode" [URL] However I cant solve the syntax.
I need to be able to navigate through the file system from an asp.net page and gather metadata on files, directories ... The simple code I've put together makes a list of directories/files in a given location and has everything displayed as a link button. My problem is with link buttons under which I have paths that include ampersands and blanks. Here's a sample of code:
[Code]....
The Response.Redirect("aPage.aspx?d="+ e.CommandArgument.ToString()); line has the problem ... the e.CommandArgument.ToString() shows a truncated path that stops just before the first ampersand detected. I tried escaping the ampersand with a backslash but it did not work ... somehow I guess it's not exactly the character that's causing the problem ..
I'm using the Google Places API to discover information on a restaurant. [URL] ....
I need my name parameter to contain an & because I am looking for D'Agostino's Pizza & Pub. But I am not sure what my URL needs to look like, because my requests are returning no matches. I am trying:
maps.googleapis.com/maps/api/place/nearbysearch/json?location=41.8957646,-87.6553512&radius=5000&types=restaurant|food&name=D'Agostino's Pizza %26 Pub&key=<mykey>. But is that even right?
I believe the search should return results, because in google if you type "D'Agostino's restaurant north ogden avenue Chicago IL", it's a perfect match there.
So it compiles, unfortunately when I run my app, it get this:
Parser Error Message: Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user name or bad password.
However, the password (which I cannot change) contains an ampersand. ASP.NET throws: Configuration Error: An error occurred while parsing EntityName. Line XX, position YYY.
If I replace the ampersand in the password with &, I get a SqlException: Login failed for user 'myUser'. Usually this trick works, but I'm guessing that something is failing because this is technically a connection string inside a connection string.
What should I do here? Most of my classes include code like:
using (var context = new MyEntities()) { // do work }
Update: It turns out that the credentials I am using are a domain account, so what I really need is Integrated Security=True in the connection string rather than a password.
Encoding the ampersand as indicated in the accepted answer should work fine, though I haven't tested it.
My employer is using a WEB based terminal emulator for its employees; here is a sample URL:http://10.20.30.40/user_custom/web6530/web6530.html?host=ZN113&service=K837062&title=EBST469K837062The URL is the same for all users, with the exception of three parameters (host, service, title); these are user unique. The URL is saved as a favorite on each PC, but the users occasionally trash it; which generates unnecessary help desk calls. I'm writing a WEB page that will prompt the user for their employee number, it will return a GridView (select enabled) with Employee number, Terminal Name, and URL (multiple rows possible); we have a SQL table that contains that info. The user clicks select and a TEXTBOX is populated with the URL, it is displayed along with a label telling the user that they can copy/paste the text into a browser or hit the connect button (button hasn't been added yet).
The URL in the DB file looks much like my sample, above, and is displayed correctly in the gridview. However, when that text is copied into another string variable or directly into the TEXTBOX the word 'amp;' shows after each ampersand (see below). Any ideas on how I can remove that because if the user pastes this string into their browser, it does not work.http://10.20.30.40/user_custom/web6530/web6530.html?host=ZN113&service=K837062&title=EBST469K837062
I have a dropdownlist with the colors loaded as th text.I place it in a placeholder and that has a vertical scrollbar, When I scroll the entire Placeholder the colours in the dropbox are getting hidden due to the scrooling
I have a dropdownlist box and have long text showing in there. I don't want to make the dropdownlist wider to show the whole text because it won't look nice in the web page. I want the functionallity similar to the following link:
[code]...
If you go to the link and put your mouse over the Secret question 2 dropdownlist it expands.
I found a good article online and am able to read data from an excel file. The excel file I created has two columns which I am populating column A as the dropdownlist text value and column B is the dropdownlist value Here is my code:
Imports System.Data Imports System.Data.OleDb Partial Class read_excel Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim myDataSet As New DataSet() Dim sXLSfile As String = Server.MapPath("/xls/class-list.xls") Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & sXLSfile & ";" & _ "Extended Properties=""Excel 8.0;""" ''You must use the $ after the object you reference in the spreadsheet Dim myData As New OleDbDataAdapter("SELECT * FROM [Fund Project List$]", strConn) myData.TableMappings.Add("Table", "ExcelFile") myData.Fill(myDataSet) ddlFund.DataSource = myDataSet.Tables(0).DefaultView ddlFund.DataTextField = "group" ddlFund.DataValueField = "groupval" ddlFund.DataBind() End Sub End Class
the excel file looks something like so (<blank> means no data in cell):
Row 1: group | groupval Row 2: ITEMS | <blank> Row 3: Blankets | Blankets Row 4: Beds | Beds Row 5: STAFF | <blank> Row 6: John Doe | John Doe
Currently my dropdown gets populated and it's text listing shows up but I want all the items that do not have a value that is blank to be indented. Anyone know if this can be done? How about if I bold just the text that has a blank value?
I am filling a dropdownlist and sometimes the value (text) is much longer than what is viewable. Is there an easy way to have user see the full text. I am currently using "ASPNET_MsgBox(Message)" and it works but looking for a better solution.
I have a dropdown list which include "yes" and "no". When I click "yes", then there have to be 2 text boxes visible, just below the dropdownlist. If the user selects "no" in the dropdownlist, then the 2 text boxes have to disappear again.
I am building a custom control that mimics a dropdownlist with my own custom items in it. I'd like to figure out how after selecting something, the text changes to what was selected.
I can do it with javascript but looking at the html source of a dropdownlist, there is no javascript there to modify the textbox/label.
I am trying to concatenate two columns (text and date) in a dropdownlist. In sql query: SelectCommand="SELECT [name] + ' , ' + [date] AS abc FROM [table] ">It gives this error: The data types nvarchar(max) and date are incompatible in the add operator.