Serving Up Multiple Content Items?
Feb 4, 2010
got a Asset Management tool which stores (in a folder("node")) an index.htm and a bunch of other asset files such as .js, .css, flv, etcHere's the problem...if I access the index.htm I get ti via it's nodeID http://site/NODEGUID/index.htm , and all compound files try and download via that GUID as well so essientially I just get index.htm content served into each request file, thus giving me an epic fail :)Is there some way in asp.net to intercept that request so I can do a lookup on the DAM and get the proper file reference and send that down instead?
View 3 Replies
Similar Messages:
Apr 17, 2010
I would like to lock down a web server that is only serving MVC content. What is the best way minimize my server's attack surface?
View 2 Replies
Feb 24, 2011
I have a domain which is receiving quite a few hits per day and have been asked if I can serve the static content from a subdomain. As the site is quite extensive and already written, I was wondering if there is any way I can use URL rewriting to change:
www.example.com/image.gif
to
static.example.com/image.gif
I have a solution which works using 301 redirects but from what I understand, this is counter productive as 2 requests will have to be made per image. I don't really want to go through all the aspx pages and css to hard code the new url as it will cause problems further down the line - some parts of the site are still being developed and static content could change at any time. I tried using rewrite (as opposed to redirect) to change the url but it came out something like:
http://www.example.com/http://static.example.com/image.gif
How would you achieve this? I have full access to dns and the server (win 2008r2 / IIS 7.5) so can make any changes if url rewriting is not the answer.
View 1 Replies
Dec 10, 2010
I'm busy writing a handler to serve various documents for download or presentation in web forms pages. The documents range from various image formats, to PDF, to MS Office documents, to generic binaries. My basic draft of the download process is as below:
[code]....
However, I have some misgivings about lumping all documents together as application/octet-stream, and I would prefer, if feasible, to use a more specific content type per document type. I have a DB table for document types where I could store this. Am I going in the right direction, and if so, where can I find a suitable starting list of content types for document types?
View 1 Replies
May 25, 2010
My WebApp is part CMS, and when I serve up an HTML page to the user it typically contains relative paths in a.href and img.src attributes. I currently have them accessed by urls like: ~/get-data.aspx/instance/user/page.html -- where instance indicates the particular instance for the report and "user/page.html" is a path created by an external application that generates the content. This works pretty reliably with code in the application's BeginRequest method that translates the text after ".aspx" into a query string, then uses Context.RewritePath(). So far so good, but I've just tripped over something that took me by surprise: it appears that if any of the query string ("instance/user/page.html") happens to contain a plus sign ("+") the BeginRequest method is never called, and a 404 is immediately returned to the user.
So my question is two-fold:
Am I correct in my belief that a "+" would cause the 404, and if so are there other things that could cause similar problems? Is there a way around that problem (perhaps a different method than BeginRequest)? Is there a better way to preserve relative URL paths for generated content than what I'm using? I'd rather not require site admins to install a 3rd party rewrite tool if I can help it.
View 1 Replies
Oct 7, 2010
I have a scenario where...
1.) Have created a div with a dropdown list and ok, cancel button
2.) On document ready - registering div created on step 1 into a jQuery dialog
3.) on a javascript button click - I am opening this dialog box.
4.) Now, the problem is - the jQuery dialogbox which I have created, needs to be used by other button clicks as well on same page. Now, my div's (which is a dialog at runtime using jQuery) ok button click is already engaged with a javascript function (button1 click) and I can not associate other button's click events with it - thus stuck up here and have no clues or hit to resolve this.
View 2 Replies
Mar 28, 2011
I'm trying to server an exe to Firefox from an aspx page. The aspx page handles the headers and the page is launched by our Flex GUI. Flex correctly launches the link for all browsers (including Firefox) so I'm certain that's not the issue.
The problem I'm having is when I try to download the file from within Firefox, FF downloads the file fine but it names it "Content". It has no extension and the file name is incorrect. All the other browsers download it with the file name I specified in the aspx page and they all have the .exe extension. I should note that if I rename the "Content" file to "Content.exe" it runs correctly.Below is the code I'm using in my aspx page -
protected void Page_Load(object sender, EventArgs e) {
string fileName = Request.QueryString["file"];
System.IO.FileInfo fileInfo = new System.IO.FileInfo(Server.MapPath(fileName));
[code]...
View 2 Replies
Mar 16, 2011
I am using the cascading dropdownlist controls from the Ajax toolkit. I have everything working perfectly and all of my select changes work. I have 3 related select boxes that all work great for single item select. What I need is for my last dropdownlist to allow for the selection of multiple items. I have tried adding the 'multiple' attribute to the final dropdown list and it allows the selection of multiple items but I cannot get the items when I post back, just a single item.
View 7 Replies
Aug 4, 2010
I have an application that needs to render a page that will have multiple Radio Button Groups as well as multiple CheckBoxes. The desired layout is determined by a database table.
table structure:
PackageID uniqueidentifier
PackageName string
ItemName string
RadioGroupName string
ViewControlName string
This table defines a "Package". The "Package" can contain many different "Items" that require different controls used in the View. The "RadioGroupName" field is used to mark which RadioButtons should be grouped together. The "ViewControl" field marks which control should be used on the View to display the field. The query in my repository will return a result set such as
1 / "First Package" / "Item1" / "First Group" / "RadioButton"
2 / "First Package" / "Item2" / "First Group" / "RadioButton"
3 / "First Package" / "Item3" / "First Group" / "RadioButton"
4 / "First Package" / "Item4" / null / "CheckBox"
5 / "First Package" / "Item5" / null / "CheckBox"
6 / "First Package" / "Item6" / "Second Group" / "RadioButton"
7 / "First Package" / "Item7" / "Second Group" / "RadioButton"
8 / "First Package" / "Item8" / "Second Group" / "RadioButton"
Given this result set, I need to render the view as follows:
A RadioButton group with 3 options (Item1, Item2, Item3)
A CheckBox (Item4)
A CheckBox (Item5)
A RadioButton group with 3 options (Item6, Item7, Item8)
I have read that it is possible to use "if" conditions and looping structures inside the View. I have also read that this is a bad practice. Another issue I see is knowing which Item has been selected from each RadioButton group when I hit the Controller POST function. Previously I have built a page that has a single RadioButton group. My ViewModel was as follows:
[Code].........................
View 1 Replies
Mar 11, 2010
Is it possible to remove an item from the master page when within a content page? so in my example i have a column on left and right which i have created in the master using divs but i want to remove them in a particular page
View 5 Replies
Mar 12, 2011
I'm running the following query:
' Show which halls they are eligible for.
Dim dbRooms As New pbu_housingEntities
Dim gender As String = Session("gender").ToString
Dim hall As String = CStr(Session("hall"))
Dim selectedRooms = (From sh In dbRooms.Rooms _
Where sh.gender = gender _
Where sh.current_occupancy < sh.max_occupancy _
Where sh.is_available = True _
Where sh.building_name = hall _
Select sh.room1, actual_available = sh.max_occupancy - sh.current_occupancy
)
rptrRooms.DataSource = selectedRooms
rptrRooms.DataBind()
Which, as you can see, is bound to a repeater. Now, it contains multiple values and I'd like to display them in a nicely formatted way, pseudo code below:
<asp:Repeater ID="rptrRooms" runat="server" OnItemCommand="Choose_Room">
<ItemTemplate>
<asp:Button ID="btnChooseRoom" runat="server"
CommandName="<%# Container.DataItem.Room1.ToString %>" Text="<%# Container.DataItem.Room1 %> : Available : <%# Container.DataItem.actual_available %>"
/>
</ItemTemplate>
</asp:Repeater>
View 1 Replies
May 19, 2010
i wanted to show multiple items detail on tool tip,as far as i know datalist is can showing single item I have scenario like Price,: item detail info : etc i googled for this but did not get the solution so far exactly.
View 4 Replies
Feb 11, 2011
have multiple menu items in an asp.menu. Each menu item has submenus. When a user selects a submenu the background color changes but I need the background color of the indivdual header menu item to change as well.
View 1 Replies
Mar 21, 2011
I try to get multiple checked items into one coloumn in my db. But i only get the first selected.
This is my sub:
[Code]....
My CheckBoxList:
[Code]....
My InsertCommand:
[Code]....
View 23 Replies
Apr 30, 2010
I am running into some additional difficulties with dropdown lists, and I'm hoping you can correct my thinking.
I have a table populated with items; ITEM_ID, ITEM_NAME, ITEM_COST.
Here is my code:
[Code]....
With this code I get this error: DataBinding: 'ITEM' does not contain a property with the name '2'.
If I remove the assignment of DataSource to c1, the dropdown generates this error: 'DropDownList3' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
How should I code this so that the user is presented with a list of ITEM_NAMES, and that the ITEM_ID is stored in the value field so I can use it when the selection event is fired? I know I could databind the source directly to the dropdown list, but I am trying to understand the behind the scenes working of a dropdown list object.
View 5 Replies
Mar 24, 2010
How do you go about removing multiple items from a array list?
I'm using the RemoveAt() method to remove but doing that resets the ArrayList's index which cause me problems if the user selects to remove 1 & 3 out of a 3 list array since once it removes 0 the array list now just has 0 & 1.
View 2 Replies
Aug 12, 2010
I have a dataTable that contains a specific column from a database. A listbox contains 100 list items in it. When page loads, I need those listbox items to be selected, whose value matches the value in the datacolumn of the datatable.
Following is the code i tried, but is not working. For some reason, it selects only the last item in the datacolumn.
if (datTableRelatedSchool.Rows.Count == 0)
{
}
else
{
foreach (DataRow row in datTableRelatedSchool.Rows)
{
foreach (DataColumn myCol in datTableRelatedSchool.Columns)
{
lstRelatedSchool.SelectedValue = row["RelatedSchoolPK"].ToString();
}
}
}
View 4 Replies
Nov 8, 2010
I have a listbox control data bound to a data source and I want to be able to get the value of each selected item so that I can use that information to form an insert query for another table. In other words be able to select a few items out of the returned list and get the selected value of each. I tried using a for each statement but came up with some strange numbers.
View 2 Replies
Nov 24, 2010
I am getting this error: "Cannot have multiple Items Selected in Dropdown", when I Edit the data.
View 2 Replies
Feb 16, 2010
I'm using a listbox to save multiple selected value in db. I'm saving that values by seperating comma(,). In edit option i want to reterive the same value from db and want show multiple selected items in listbox.
View 9 Replies
Dec 9, 2010
I have two databound listboxes. The first only shows items that have been assigned to my product. The second listbox shows all available items. What I want to do is select all of the items in listbox 2 that list box one contains.
For example:
ListBox1-
Item 1
Item 3
ListBox2-
Item 1 (Selected)
Item 2
Item 3 (Selected)
Code I have:
List<string> myList = new List<string>();
foreach(ListItem f in ListBoxSourceDetail.Items)
{
myList.Add(f.Value);
}
myList.ForEach(delegate(string n)
{
ListBoxSourceEdit.SelectedValue = n;
});
View 1 Replies
Jul 29, 2010
I am persisting the search selection criteria of a listbox onto another page which is called AreasLb. Multiple areas can be selected, I simply want to set the listbox items that the user selected as .Selected = true
I think the below code should work, but it doesn't, with no items in the Listbox being selected.
if (s == "Areas")
{
string[] area = nv[s].Substring(0, (nv[s].Length - 1)).Split(';');
int i = 0;
foreach (ListItem item in AreasLb.Items)
{
foreach (var s1 in area)
{
if (s1 == item.Value)
{
AreasLb.Items[i].Selected = true;
}
continue;
}
i = i + 1;
}
continue;
}
View 2 Replies
May 7, 2015
System.Web.HttpException: Cannot have multiple items selected in a DropDownList.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Cannot have multiple items selected in a DropDownList.
I have a nested gridview and inisde a child grid there are several columns having dropdown and one add button. when add button is click a new row inside a child grid is created with an empty dataand previous row data have been saved in viewstate so that it can be bind wen add button is click to create new rows.My code is working fine when i dont select any dropdown list item and new row is also created but wen i select items from dropdown and click on add more button i get above error.
When add button is click
protected void ButtonAdd_Click(object sender, EventArgs e) {
Button gv = ((sender) as Button);
string[] ParentIdArray = gv.ClientID.ToString().Split('_');
int ParentId = int.Parse(ParentIdArray[1].ToString().Replace("ctl", "").Trim()) - 2;
int RecordCount = ((GridView)GVMain.Rows[ParentId].FindControl("grdAddHotel")).Rows.Count;
DataTable dtAddHotel = new DataTable();
dtAddHotel.Columns.Add("CostSheetId");
[Code] .....
View 1 Replies
Mar 7, 2011
We have a large site with thousands of static html files. Some of them are ISO-8859-1, others are UTF-8 (with and without byte order marks).
The web.config file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" />
</system.web>
</configuration>
If I change the fileEncoding to "ISO-8859-1" it works for both ISO-8859-1 and UTF-8 if there is a byte order mark. We are trying to avoid manually checking and adding byte order marks to files that do not have them. Is there any way to accomplish this?
The files have the charset meta tag. Can we make the server read that to determine the file encoding?
EDIT
If I remove the wildcard application mapping to aspnet_isapi.dll the files are served correctly. Is there any way to have the wildcard match everything except for .html?
View 1 Replies
Apr 13, 2010
I'm trying to serve a pdf file from a database in ASP.NET using an Http Handler, but every time I go to the page I get an error
XML Parsing Error: no element found
Location: https://ucc489/rc/NoteFileHandler.ashx?noteId=1,msdsId=3
Line Number 1, Column 1:
public class NoteFileHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
[code]...
View 1 Replies