|
Using ASP.NET 2.0, say I want to store a picture in “C:\Users\user123\images\MyPortrait.jpg” on the server. How can I have the user access it through an aspx page? Because it seems I can only get the Image control to reference a url that is within the Website directory.
|
|
|
|
|
To make files accessible from the web you have to expose them through the web server. If you want to store the files somewhere outside the web root folder structure, you can create a virtual directory that exposes a folder somewhere else on the server.
---
b { font-weight: normal; }
|
|
|
|
|
I'm looking for something like:
Image CurrentImage = System.Web.UI.WebControls.Image.FromStream((byte[])dataReader["ImageStream"]);
However I'm not finding anything like that for ASP .Net pages and it appears you either have to reference another page and pipe the image from it or flush the stream to disk and then set the CurrentImage.UrlPath = Server.MapPath...
Anybody know how I can set an System.Web.UI.WebControls.Image = {Some type of function that will load a bufferred stream directly from memory.}?
Thanks!
- Rex
|
|
|
|
|
Hi Rex,
As you know that the Image server control renders to the img element at the client side and you would normally set the url of the image file in the ImageUrl property. In your case, if you want to display the image from the stream (or display inline image), you can encode the binary content as base64 string before setting the ImageUrl property in the format ImageUrl="data:image/gif;base64,R0hkgA0APfmAENOT..." If you search for "display inline image", Google could bring up some more information. However, the downside of this way is that only non-Microsoft browsers support it, (ah you can blame Microsoft for that) so you have to keep setting the url of an web page, http hanler with the id of the image so that you can pull it out later. Another option instead of writing out the image to disk is to save the image in memory such as Cache (with Cache you can set the time duration to kick it out), and you can send the image contents later in the ShowImage web page.
|
|
|
|
|
|
Hi All!
When I try to open a .asp page in ASP.net 2.0 I get followin error.
The type of page you have requested is not served because it has been explicitly forbidden. The extension '.asp' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Can classic asp page be opened in ASP.net 2.0.
Thanks
|
|
|
|
|
Please do not use bold on the entire message.
What do you mean when you say that you try to open the .asp page in ASP.NET? Do you mean that you try to browse to the page, or do you try to request the page from your ASP.NET code?
If you want to use ASP pages you have to configure the server to allow them.
---
b { font-weight: normal; }
|
|
|
|
|
Sorry for that.
I call .asp page on button click on the client side by using Window.open method of javascript. How to configure server to allow them. Might be I 've to override default ForbiddenHandler property for .asp page but completely not sure what to do.
Thanks
|
|
|
|
|
In the IIS manager, in the properties for the application, in the Home Directory tag, open the configuration. Make sure that there is a mapping for asp files, pointing to "C:\WINNT\system32\inetsrv\asp.dll".
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for the reply but this setting is already there and it is not working.Any idea what should I do?
|
|
|
|
|
Check the web.config and machine.config files to ensure that you haven't got the extension ASP mapped to System.Web.HttpForbiddenHandler. Check that you don't have the following:
<add verb="*" path="*.asp" type="System.Web.HttpForbiddenHandler">
Regards
Pete O'Hanlon
|
|
|
|
|
Hi I've checked this but HttpForbiddenHandler is mapped to .asp only in Dotnet 1.1 not in Dotnet 2.0 which I'm currently working upon.Any ideas what could be done.?
Regards!!
|
|
|
|
|
Are you browsing to the page through IIS, and not using the built in server in Visual Studio? The built in server has no support for ASP.
---
b { font-weight: normal; }
|
|
|
|
|
Ya You are right.Built in server does not support asp.IIS does.
Thanks!!
|
|
|
|
|
Hi Friendz,
I am adding records from aspx page by clicking ADD button, I want that after adding one record, it should display a pop up menu having message if you want to add another record.
How can I do this, help me plz..
Prabir
|
|
|
|
|
You can do this by using javascript code in the aspx page
Add Button
add code: on click="return confirm('Do u want to add another record?');"
Regards,
sdaniel_cst
|
|
|
|
|
Hello Prabir,
the Messagebox is easy. Add following code in your Button-Handler:
If Not Me.IsStartupScriptRegistered("MsgBox") Then
dim sTemp as String = ""
sTemp = "<script language=JavaScript>" & vbCrLf
sTemp += "alert ('Do you want add another record?);" & vbCrLf
sTemp += "</script>" & vbCrLf
Me.RegisterStartupScript("MsgBox", sTemp)
End If
If the user should take a choice replace the alert-call through a confirm-call. If this returns true the OK-Button was pressed.
Regards
Stephan
\\\| \\ - -
( @ @ )
+---------------oOOo-(_)-oOOo-----------------+
| Stephan Pilz stephan.pilz@stephan-pilz.de |
| <a href=www.stephan-pilz.de>www.stephan-pilz.de</a> |
| ICQ#: 127823481 |
+-----------------------Oooo------------------+
oooO ( )
( ) ) /
\ ( (_/
\_)
|
|
|
|
|
You can use javascript confirm message for this purpose.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Dear Sirs,
Thanx for your replay,I am able to get the javascript which conforms If I want to add a record. But the problem is now, after adding I need to another pop up menu which sholud show if user want to add another record or not,basically I need to generate another event after clicking AddRecord button.
Plz help me..
|
|
|
|
|
Hi,
I'm using two Listcontrols. From the first List I'll be adding items to the second list. The second list has 3 columns. Name, Operator , Value. In operator I have a combobox to select the operators <, >, = etc. The problem is I have to check whether the operator is repeated for the same name. I've to check in Kill focus function of combobox.
Pls do help
|
|
|
|
|
So what is your question?
If you are wondering how to check the value of a combobox, you can just use this:
myComboBox.SelectedValue
Or if your question is related to how to get it to actually hit the code (I'm assuming your working on a web project because this is the asp.net messageboard, in which case we are talking about a DropDownList control instead of a ComboBox...) Then your problem may be that you need to set the DropDownList's AutoPostBack property to True and you will probably have to put the code to do the checks in the PageLoad event within an IsPostBack if statement.
If your question is something else, could you please explain it in more detail?
|
|
|
|
|
I added a dataset to my website.
I gave the method names as Fill() and Get() in the dataset.
In the web form I tried to access the Tableadapter by creating an object.
But cant do it. Can anybody please help me out...
sda_cst
|
|
|
|
|
|
Do check that 'TableAdapter' & its associated methods from your ClassView , whether it is created properly (in your NameSpace, if specified).
Regards,
Jay
|
|
|
|
|
hello to all
i am working on ASP.NET 2
i want to maintain the scroll position between postbacks to the server
(i can scroll to top of my page when i set smartNavigation is true in web.config, but microsoft says its an obselete property, so i can't use in ASP.NET 2)
thanks in adv.
mohan
Mohan G
|
|
|
|