Thursday, March 29, 2012
newbie: Help, I have problems with this!
asp.net 2.0
visual web developer 2005 express
I have a webpage which contains 1 Repeater control. Into this repeater
control I want to add several rows of data. My problem is that 1 of the data
is an array of bytes (it's a picture saved to the database as bytes) and I
want that picture to be displayed nicely in the repeater list...
Here is two approaches (approach A and approach B) I'm trying:
APPROACH A:
Use the scenario of 2 .aspx files, 1 .aspx (A) convert the bytes of array
into a picture and the other .aspx file (B) has a img tag pointing to the
first .aspx file (A)
But here I get problems with this line "img.Src =
"Thumnail.aspx?ImageID=1";", it looks like it expects a object... Somehow I
need to send over a parameter to this Thumbnail.aspx file about which image
to display... Lets say the resultset has many images, but this row shall
display one particular image
protected void rptInbox_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
System.Web.UI.HtmlControls.HtmlImage img = null;
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {
img =
(System.Web.UI.HtmlControls.HtmlImage)e.Item.FindControl("Photo");
img.Src = "Thumnail.aspx?ImageID=1";
}
}
<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="inbox.aspx.cs"
Inherits="webForms_Profile_inbox" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="content" Runat="Server">
<asp:ObjectDataSource ID="odsInbox" runat="server"
SelectMethod="getInbox" TypeName="BusinessLogic.NetworkLogic">
</asp:ObjectDataSource>
<asp:Repeater ID="rptInbox" runat="server" DataSourceID="odsInbox"
OnItemDataBound="rptInbox_ItemDataBound">
<ItemTemplate>
<tr>
<td bgcolor="#CCFFCC">
<%# Eval("Name") %>
<img ID="Photo" src="http://pics.10026.com/?src=" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="sidebar" Runat="Server">
</asp:Content>
****************************************
************************
APPROACH B:
In this approach I tryed to replace the img tag with a Image control in the
repeater.
But the "System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);"
gives this error:
"Parameter is not valid."
Another thing is that I'm not sure this is a good approach because it uses
bmp.Save() and I'm afraid the server will run out of space if images get
saved on the server each time th page is displayed?
protected void rptInbox_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
//System.Web.UI.HtmlControls.HtmlImage img = null;
System.Web.UI.WebControls.Image img = null;
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {
img =
(System.Web.UI.WebControls.Image)e.Item.FindControl("Photo");
byte[] data = Profile.Picture;
Int32 offset = 78;
System.IO.MemoryStream mstream = new System.IO.MemoryStream();
mstream.Write(data, offset, data.Length - offset);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);
bmp.Save(Server.MapPath("sample.jpeg"),
System.Drawing.Imaging.ImageFormat.Jpeg);
mstream.Close();
img.ImageUrl = Server.MapPath("sample.jpeg");
}
//e.Item.DataItem.ToString();
}
Please help me with this one, I'm stucked in this problem...
Best Regards
Jeffhi Jeff
I think I've covered this in a previous thread, but anyways
on this page is an example of dynamically displaying binary image data
on a Web page. this uses a GridView but the logic's the same
http://authors.aspalliance.com/aspx...classbinarywri=
te.aspx
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
Reynald V. Nu=F1ez
http://authors.aspalliance.com/aspxtreme
newbie: Help, I have problems with this!
asp.net 2.0
visual web developer 2005 express
I have a webpage which contains 1 Repeater control. Into this repeater
control I want to add several rows of data. My problem is that 1 of the data
is an array of bytes (it's a picture saved to the database as bytes) and I
want that picture to be displayed nicely in the repeater list...
Here is two approaches (approach A and approach B) I'm trying:
APPROACH A:
Use the scenario of 2 .aspx files, 1 .aspx (A) convert the bytes of array
into a picture and the other .aspx file (B) has a img tag pointing to the
first .aspx file (A)
But here I get problems with this line "img.Src =
"Thumnail.aspx?ImageID=1";", it looks like it expects a object... Somehow I
need to send over a parameter to this Thumbnail.aspx file about which image
to display... Lets say the resultset has many images, but this row shall
display one particular image
protected void rptInbox_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
System.Web.UI.HtmlControls.HtmlImage img = null;
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {
img =
(System.Web.UI.HtmlControls.HtmlImage)e.Item.FindC ontrol("Photo");
img.Src = "Thumnail.aspx?ImageID=1";
}
}
<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="inbox.aspx.cs"
Inherits="webForms_Profile_inbox" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="content" Runat="Server">
<asp:ObjectDataSource ID="odsInbox" runat="server"
SelectMethod="getInbox" TypeName="BusinessLogic.NetworkLogic">
</asp:ObjectDataSource>
<asp:Repeater ID="rptInbox" runat="server" DataSourceID="odsInbox"
OnItemDataBound="rptInbox_ItemDataBound">
<ItemTemplate>
<tr>
<td bgcolor="#CCFFCC">
<%# Eval("Name") %>
<img ID="Photo" src="http://pics.10026.com/?src=" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="sidebar" Runat="Server">
</asp:Content>
************************************************** **************
APPROACH B:
In this approach I tryed to replace the img tag with a Image control in the
repeater.
But the "System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);"
gives this error:
"Parameter is not valid."
Another thing is that I'm not sure this is a good approach because it uses
bmp.Save() and I'm afraid the server will run out of space if images get
saved on the server each time th page is displayed?
protected void rptInbox_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
//System.Web.UI.HtmlControls.HtmlImage img = null;
System.Web.UI.WebControls.Image img = null;
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {
img =
(System.Web.UI.WebControls.Image)e.Item.FindContro l("Photo");
byte[] data = Profile.Picture;
Int32 offset = 78;
System.IO.MemoryStream mstream = new System.IO.MemoryStream();
mstream.Write(data, offset, data.Length - offset);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);
bmp.Save(Server.MapPath("sample.jpeg"),
System.Drawing.Imaging.ImageFormat.Jpeg);
mstream.Close();
img.ImageUrl = Server.MapPath("sample.jpeg");
}
//e.Item.DataItem.ToString();
}
Please help me with this one, I'm stucked in this problem...
Best Regards
Jeffhi Jeff
I think I've covered this in a previous thread, but anyways
on this page is an example of dynamically displaying binary image data
on a Web page. this uses a GridView but the logic's the same
http://authors.aspalliance.com/aspx...inarywrite.aspx
==============================
Reynald V. Nuez
http://authors.aspalliance.com/aspxtreme
Newbie: How do I install a control in order to use it?
JosenAre you talking about a 3rd party control?
Yes. I want to use the control at the following link...
http://scottonwriting.net/demos/RoundedCorners.aspx
It really depends on your editor - -
if you're using VS.Net - you right click on the tools section and add the new control into your project.
If you're just using a text editor - copy the dll you download, into your bin directory and inside your aspx page - just use the markup they have on that page and change the appearance the way you need.
That's what I was looking for...
Thanks,
Josen
Oh... what's the full path to the bin directory?
The bin folder is placed in the root directory of your website.
your bin directory should be at the root of your web application.
/bin/
Rounded corners is pretty sweet, I started using it the past few days.
You can also open windows explorer and find the .dll and drag it onto your vs.net toolbox.
Newbie: How do I create Dynamic instrument widgets in ASP.NET
I want to create a dynamic web page, which presents various instrument
widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
browser, with continous data updates from Server side data. Obviously
these instruments need to be constantly refreshed (every 0.5 second or
so) and not just on page load.
With Windows Forms, and GDI I can do this with networked Thick Client
code. I can also do dynamic web instruments with Java Applets, and I
guess DHTML/Javascript. But I really want to do the instruments in C#
and .NET. But I don't think that I can achieve this, because http and
ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
upon Server side controls, that won't refresh my instruments with live
data, once the page is downloaded. (Traditional DHTML/Javascript looks
like a real pain to develop instruments in.)
I am agreat fan of .NET technologies, but I was hoping for better MS
and .NET support for these instrument based web applications. But I
guess my only real choice is Java Applets !
Any suggestions on how I can achieve dynamic web instruments with .NET
technology would be appreciated.
Thanks
JulesThere may well be other ways of acheiving this kind of thing, but you could
just refresh the image (in JS) representing the clock
or you could use the WebBehaviour stuff, this will allow you to connect to a
webservice on the server (using JS again) then you can update your clock or
gauge or whatever in the JS on the client.
"Jules" <Roseanna80@.hotmail.com> wrote in message
news:80bc211e.0503310335.15a8c492@.posting.google.com...
> Hello,
> I want to create a dynamic web page, which presents various instrument
> widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
> browser, with continous data updates from Server side data. Obviously
> these instruments need to be constantly refreshed (every 0.5 second or
> so) and not just on page load.
> With Windows Forms, and GDI I can do this with networked Thick Client
> code. I can also do dynamic web instruments with Java Applets, and I
> guess DHTML/Javascript. But I really want to do the instruments in C#
> and .NET. But I don't think that I can achieve this, because http and
> ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
> upon Server side controls, that won't refresh my instruments with live
> data, once the page is downloaded. (Traditional DHTML/Javascript looks
> like a real pain to develop instruments in.)
> I am agreat fan of .NET technologies, but I was hoping for better MS
> and .NET support for these instrument based web applications. But I
> guess my only real choice is Java Applets !
> Any suggestions on how I can achieve dynamic web instruments with .NET
> technology would be appreciated.
> Thanks
> Jules
I'd say your requirements don't lend themselves to building a browser based
application. Consider building a traditional fat client app using ClickOnce
or NoTouch Deployment. A java applet is really no different.
-Brock
DevelopMentor
http://staff.develop.com/ballen
> Hello,
> I want to create a dynamic web page, which presents various instrument
> widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
> browser, with continous data updates from Server side data. Obviously
> these instruments need to be constantly refreshed (every 0.5 second or
> so) and not just on page load.
> With Windows Forms, and GDI I can do this with networked Thick Client
> code. I can also do dynamic web instruments with Java Applets, and I
> guess DHTML/Javascript. But I really want to do the instruments in C#
> and .NET. But I don't think that I can achieve this, because http and
> ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
> upon Server side controls, that won't refresh my instruments with live
> data, once the page is downloaded. (Traditional DHTML/Javascript looks
> like a real pain to develop instruments in.)
> I am agreat fan of .NET technologies, but I was hoping for better MS
> and .NET support for these instrument based web applications. But I
> guess my only real choice is Java Applets !
> Any suggestions on how I can achieve dynamic web instruments with .NET
> technology would be appreciated.
> Thanks
> Jules
>
Newbie: How do I create Dynamic instrument widgets in ASP.NET
I want to create a dynamic web page, which presents various instrument
widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
browser, with continous data updates from Server side data. Obviously
these instruments need to be constantly refreshed (every 0.5 second or
so) and not just on page load.
With Windows Forms, and GDI I can do this with networked Thick Client
code. I can also do dynamic web instruments with Java Applets, and I
guess DHTML/Javascript. But I really want to do the instruments in C#
and .NET. But I don't think that I can achieve this, because http and
ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
upon Server side controls, that won't refresh my instruments with live
data, once the page is downloaded. (Traditional DHTML/Javascript looks
like a real pain to develop instruments in.)
I am agreat fan of .NET technologies, but I was hoping for better MS
and .NET support for these instrument based web applications. But I
guess my only real choice is Java Applets !
Any suggestions on how I can achieve dynamic web instruments with .NET
technology would be appreciated.
Thanks
JulesThere may well be other ways of acheiving this kind of thing, but you could
just refresh the image (in JS) representing the clock
or you could use the WebBehaviour stuff, this will allow you to connect to a
webservice on the server (using JS again) then you can update your clock or
gauge or whatever in the JS on the client.
"Jules" <Roseanna80@.hotmail.com> wrote in message
news:80bc211e.0503310335.15a8c492@.posting.google.c om...
> Hello,
> I want to create a dynamic web page, which presents various instrument
> widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
> browser, with continous data updates from Server side data. Obviously
> these instruments need to be constantly refreshed (every 0.5 second or
> so) and not just on page load.
> With Windows Forms, and GDI I can do this with networked Thick Client
> code. I can also do dynamic web instruments with Java Applets, and I
> guess DHTML/Javascript. But I really want to do the instruments in C#
> and .NET. But I don't think that I can achieve this, because http and
> ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
> upon Server side controls, that won't refresh my instruments with live
> data, once the page is downloaded. (Traditional DHTML/Javascript looks
> like a real pain to develop instruments in.)
> I am agreat fan of .NET technologies, but I was hoping for better MS
> and .NET support for these instrument based web applications. But I
> guess my only real choice is Java Applets !
> Any suggestions on how I can achieve dynamic web instruments with .NET
> technology would be appreciated.
> Thanks
> Jules
I'd say your requirements don't lend themselves to building a browser based
application. Consider building a traditional fat client app using ClickOnce
or NoTouch Deployment. A java applet is really no different.
-Brock
DevelopMentor
http://staff.develop.com/ballen
> Hello,
> I want to create a dynamic web page, which presents various instrument
> widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
> browser, with continous data updates from Server side data. Obviously
> these instruments need to be constantly refreshed (every 0.5 second or
> so) and not just on page load.
> With Windows Forms, and GDI I can do this with networked Thick Client
> code. I can also do dynamic web instruments with Java Applets, and I
> guess DHTML/Javascript. But I really want to do the instruments in C#
> and .NET. But I don't think that I can achieve this, because http and
> ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
> upon Server side controls, that won't refresh my instruments with live
> data, once the page is downloaded. (Traditional DHTML/Javascript looks
> like a real pain to develop instruments in.)
> I am agreat fan of .NET technologies, but I was hoping for better MS
> and .NET support for these instrument based web applications. But I
> guess my only real choice is Java Applets !
> Any suggestions on how I can achieve dynamic web instruments with .NET
> technology would be appreciated.
> Thanks
> Jules
newbie: How do I add a project....
visual studio 2005
I have a asp.net 2.0 project and a class library project. Both projects
created in visual studio 2005. I want to add the class library project to
the asp.net 2.0 project.
I want to add the library project so that I can reference the project,
instead of the compiled file...
I've already tryed to using the "Add Existing Item..." window in the asp.net
2.0 project, which only added the file I selected (.sln file). I don't think
this is the correct way of doing it...
Any suggestions?
JeffHi Jeff,
File->Open Project/Solution and remember to mark Add to solution instead
of Close solution.
On Thu, 14 Sep 2006 12:06:10 +0200, Jeff
<it_consultant1@.hotmail.com.NOSPAMwrote:
Quote:
Originally Posted by
Hey
>
visual studio 2005
>
I have a asp.net 2.0 project and a class library project. Both projects
created in visual studio 2005. I want to add the class library project to
the asp.net 2.0 project.
>
I want to add the library project so that I can reference the project,
instead of the compiled file...
>
I've already tryed to using the "Add Existing Item..." window in the
asp.net
2.0 project, which only added the file I selected (.sln file). I don't
think
this is the correct way of doing it...
>
Any suggestions?
>
Jeff
>
>
--
Happy Coding!
Morten Wennevik [C# MVP]
thanks
"Morten Wennevik" <MortenWennevik@.hotmail.comwrote in message
news:op.tfu46bz6klbvpo@.tr024.bouvet.no...
Quote:
Originally Posted by
Hi Jeff,
>
File->Open Project/Solution and remember to mark Add to solution instead
of Close solution.
>
>
>
On Thu, 14 Sep 2006 12:06:10 +0200, Jeff
<it_consultant1@.hotmail.com.NOSPAMwrote:
>
Quote:
Originally Posted by
>Hey
>>
>visual studio 2005
>>
>I have a asp.net 2.0 project and a class library project. Both projects
>created in visual studio 2005. I want to add the class library project to
>the asp.net 2.0 project.
>>
>I want to add the library project so that I can reference the project,
>instead of the compiled file...
>>
>I've already tryed to using the "Add Existing Item..." window in the
>asp.net
>2.0 project, which only added the file I selected (.sln file). I don't
>think
>this is the correct way of doing it...
>>
>Any suggestions?
>>
>Jeff
>>
>>
>
>
>
--
Happy Coding!
Morten Wennevik [C# MVP]
newbie: how do I? <export table to sql script>
I've created a simple asp.net 2.0 (visual studio 2005) project containing a
database in the App_Data folder
I wonder how I can export individual tables from this database to sql
script...
Any suggestions?
JeffOkay, I've sold this by using Sql Express 2005 Managment Tool
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23EHhcDF%23GHA.4696@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
Hey
>
I've created a simple asp.net 2.0 (visual studio 2005) project containing
a database in the App_Data folder
>
I wonder how I can export individual tables from this database to sql
script...
>
Any suggestions?
>
Jeff
>
I mean solved it... :-)
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23TnApCG%23GHA.748@.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
Okay, I've sold this by using Sql Express 2005 Managment Tool
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23EHhcDF%23GHA.4696@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
>Hey
>>
>I've created a simple asp.net 2.0 (visual studio 2005) project containing
>a database in the App_Data folder
>>
>I wonder how I can export individual tables from this database to sql
>script...
>>
>Any suggestions?
>>
>Jeff
>>
>
>
newbie: how do I? <export table to sql script>
I've created a simple asp.net 2.0 (visual studio 2005) project containing a
database in the App_Data folder
I wonder how I can export individual tables from this database to sql
script...
Any suggestions?
JeffOkay, I've sold this by using Sql Express 2005 Managment Tool
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23EHhcDF%23GHA.4696@.TK2MSFTNGP05.phx.gbl...
> Hey
> I've created a simple asp.net 2.0 (visual studio 2005) project containing
> a database in the App_Data folder
> I wonder how I can export individual tables from this database to sql
> script...
> Any suggestions?
> Jeff
>
I mean solved it... :-)
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23TnApCG%23GHA.748@.TK2MSFTNGP02.phx.gbl...
> Okay, I've sold this by using Sql Express 2005 Managment Tool
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:%23EHhcDF%23GHA.4696@.TK2MSFTNGP05.phx.gbl...
>
Newbie: How safe is source code?
I am a complete newbie and am contemplating moving to asp.net from asp. How
protected is an asp.net web site source code should it be delivered to a
client?
Thanks
RegardsMy opinion:
If your concern is about protecting access to the code itself, then ASP.NET
source is much safer than classic ASP, because the deliverable is actually a
set of compiled .dll's, rather than a set of vbscript files.
However, you should be aware that it is notoriously easy to decompile a .NET
assembly into very clean source code. If this worries you, you should
consider using an obfuscator to "scramble" the dll code so that decompiling
either doesn't work or doesn't work very well.
-Michael
"John" <john@.nospam.infovis.co.uk> wrote in message
news:Oo1BKKIpDHA.2732@.TK2MSFTNGP11.phx.gbl...
> Hi
> I am a complete newbie and am contemplating moving to asp.net from asp.
How
> protected is an asp.net web site source code should it be delivered to a
> client?
> Thanks
> Regards
Hi John,
You should obfuscate your ASP.NET with Dotfuscator (a .NET
obfuscator).
A lite version is included inside VS.NET 2003 under the tools menu.
This will make reverse engineered code harder to understand.
If you want more protection that significantly hinders reverse
engineering by crashing or stopping decompilers and support look at
Dotfuscator Professional Edition.
For more info: www.preemptive.com/dotfuscator
Best Regards,
Dotfuscator Team
> "John" <john@.nospam.infovis.co.uk>
> > Hi
> > I am a complete newbie and am contemplating moving to asp.net from asp.
> How
> > protected is an asp.net web site source code should it be delivered to a
> > client?
I agree. But what about 'Whidbey' (new VS 2004)? I think we going
back to no code-behind'.
-----------------------
http://www.naptaxes.com/AAJ/
[AllAmericanJobs - Searching jobs from your desktop and automatically
sends resume.]
Even with 'no code behind' isn't the result still .NET code which can be decompiled?
> I agree. But what about 'Whidbey' (new VS 2004)? I think we going
> back to ?no code-behind'.
Newbie: How to compare strings?
On my drop down list control, i am trying to set the
DropDownList1.SelectedValue property to the selected string value. In my
example, my DropDownList1 control contains three colors:
- Carlos
- Mike
- Susan
However, if i try to set the DropDownList1.SelectedValue = "carlos"; i get
the following error: "Exception: Specified argument was out of the range of
valid values. Parameter name: carlos." This is b/c "Carlos" != to "carlos".
I realize that i can convert all the drop down list controls values to
uppercase, however, i'd like to keep the names as they are entered by the
user.
Is there anyway to compare these strings, ignoring any differences in
uppercase or lowercase?
Thanks!String.Compare("CARLOS", "carlos", true);
-Brock
DevelopMentor
http://staff.develop.com/ballen
> Hi,
> On my drop down list control, i am trying to set the
> DropDownList1.SelectedValue property to the selected string value. In
> my example, my DropDownList1 control contains three colors:
> - Carlos
> - Mike
> - Susan
> However, if i try to set the DropDownList1.SelectedValue = "carlos"; i
> get the following error: "Exception: Specified argument was out of the
> range of valid values. Parameter name: carlos." This is b/c "Carlos"
> != to "carlos".
> I realize that i can convert all the drop down list controls values to
> uppercase, however, i'd like to keep the names as they are entered by
> the user.
> Is there anyway to compare these strings, ignoring any differences in
> uppercase or lowercase?
> Thanks!
Newbie: How to compare strings?
On my drop down list control, i am trying to set the
DropDownList1.SelectedValue property to the selected string value. In my
example, my DropDownList1 control contains three colors:
- Carlos
- Mike
- Susan
However, if i try to set the DropDownList1.SelectedValue = "carlos"; i get
the following error: "Exception: Specified argument was out of the range of
valid values. Parameter name: carlos." This is b/c "Carlos" != to "carlos".
I realize that i can convert all the drop down list controls values to
uppercase, however, i'd like to keep the names as they are entered by the
user.
Is there anyway to compare these strings, ignoring any differences in
uppercase or lowercase?
Thanks!String.Compare("CARLOS", "carlos", true);
-Brock
DevelopMentor
http://staff.develop.com/ballen
> Hi,
> On my drop down list control, i am trying to set the
> DropDownList1.SelectedValue property to the selected string value. In
> my example, my DropDownList1 control contains three colors:
> - Carlos
> - Mike
> - Susan
> However, if i try to set the DropDownList1.SelectedValue = "carlos"; i
> get the following error: "Exception: Specified argument was out of the
> range of valid values. Parameter name: carlos." This is b/c "Carlos"
> != to "carlos".
> I realize that i can convert all the drop down list controls values to
> uppercase, however, i'd like to keep the names as they are entered by
> the user.
> Is there anyway to compare these strings, ignoring any differences in
> uppercase or lowercase?
> Thanks!
>
newbie: how to compare bit field from sql table to oledbdatareader?
I'm having trouble to use compare the value off that table using OleDbDataReader, please help correct my code:
string connectionString = "(connect goes here)";
string sql = "SELECT isActived FROM List WHERE ID=@dotnet.itags.org.ID";
SqlConnection conn = new SqlConnection(connectionString);
SqlDataReader reader = null;
conn.Open();
SqlCommand cmd = new SqlCommand(sql,conn);
cmd.Parameters.Add("@dotnet.itags.org.license", "(my id number goes here)");
reader = cmd.ExecuteReader();
(something wrong with this code:) bool temp = reader["isActived"];
(or this:) if (reader["isActived"] == true)
reader.Close();
conn.Close();
TIA
After a call to ExecuteRead, the reader is positioned before the first row. You must call reader.Read() to position the reader on a row before you attempt to access any data.
If you only get one value back, you may try this:
bool temp = cmd.ExecuteScalar();
thanks DMW, Jimmy, looks like ExecuteScalar would help me save a couple lines of code :)
Newbie: How to display search results?
I have a web page (page1) where I allow the user to make a search, text box
plus a botton (botton1).
When he click the botton (button1), the server obtain (from memory) an array
of Products Id.
I want to open a second web page (page 2) with the results (obtained from a
database using the Products Id), the results will be shown in a datagrid.
My question:
- If Once I clicked botton1 I retrieve from de database the Products (using
the array of ProductsId and a datareader) how I bound this datareader to the
datagrid in page2?.
- I think there is a second option: I pass the array (memory array) of
products Id to Page2 (how i do it?) and the Onload event of Page2 read the
data from the database and show it in the datagrid. How I pass the memory
array to Onload event of Page2?.
I am pretty new to ASP.NET so I suspect there is an standard way of doing
this, I welcome any suggestion.
Thanks,
JaimeI am new to ASP.NET, so probably my question is very basic:
Quote:
Originally Posted by
>
I have a web page (page1) where I allow the user to make a search, text box
plus a botton (botton1).
When he click the botton (button1), the server obtain (from memory) an array
of Products Id.
I want to open a second web page (page 2) with the results (obtained from a
database using the Products Id), the results will be shown in a datagrid.
>
By "open a second page", do you mean "open in a new window", or just
"replace the current page"? If new window, then see if there is a
"target" attribute on that button (button1). If current page, then
nothing special needs to be done.
Quote:
Originally Posted by
My question:
- If Once I clicked botton1 I retrieve from de database the Products (using
the array of ProductsId and a datareader) how I bound this datareader to the
datagrid in page2?.
- I think there is a second option: I pass the array (memory array) of
products Id to Page2 (how i do it?) and the Onload event of Page2 read the
data from the database and show it in the datagrid. How I pass the memory
array to Onload event of Page2?.
>
I am pretty new to ASP.NET so I suspect there is an standard way of doing
this, I welcome any suggestion.
>
Thanks,
>
Jaime
To switch from one page to another, you can use "Response.Redirect()",
using the new url as a parameter.
To pass data from one page to another, there are several options:
- querystring, like "page2.aspx?searchtext=bla". Best for a small list
of short values, that can be represented by a string.
- Session data. In page1 you store "it" in the session
(Session["productids"] = list) and in page2 you read it, casting as
required ( int[] list = (int[])Session["productids"] )
You can perform the search in page1, passing the results (via Session)
to page2. Or you can pass the searchtext to page2 (session or
querystring), where the complete search is performed. I like the second
option better, as you concentrate the "search functionality" in that
page.
Hans Kesting
Newbie: How to duplicate a webform (including code) - I'm confused.
I am sure there is a very simple answer to this question. But how does one
duplicate a webform in ASP.net? E.g. I have a webform that has standard
basic functionality for my whole web application (e.g. a navigation bar and
general layout). I want to copy this form many times as it is the template
for each page within my application.
However, when I use "save as" and save the webform as a different name,
things do not go as planned. Also I want all the underlying code to be
copied as well (e.g. so if I use a link button, on my first page, I want the
underlying code for that button to also copy through to the duplicate page).
So how is this achieved?
I'm probably going to be told there is a better way of having a template
page as well. This information will be useful as well, but for the time
being, duplicating manually a template page will do fine.
Kind regards
Dave.Dave, in ASP.NET 1.x, there's not a real easy way to do this. There are
Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
but these have poor tool support in VS.NET 2002/2003.
Fortunately this becomes much less of a pain with ASP.NET 2.0 and Visual
Studio 2005... but for the time being, it's not as easy as it *should*
be. But do check out Master Pages in ASP.NET 1.x, it's better than just
copying and pasting code around on each page...
Dave Smithz wrote:
> I am sure there is a very simple answer to this question. But how does one
> duplicate a webform in ASP.net? E.g. I have a webform that has standard
> basic functionality for my whole web application (e.g. a navigation bar an
d
> general layout). I want to copy this form many times as it is the template
> for each page within my application.
> However, when I use "save as" and save the webform as a different name,
> things do not go as planned. Also I want all the underlying code to be
> copied as well (e.g. so if I use a link button, on my first page, I want t
he
> underlying code for that button to also copy through to the duplicate page
).
> So how is this achieved?
> I'm probably going to be told there is a better way of having a template
> page as well. This information will be useful as well, but for the time
> being, duplicating manually a template page will do fine.
Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com
* When you think ASP.NET, think 4GuysFromRolla.com!
"Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
this. There are
> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
> but these have poor tool support in VS.NET 2002/2003.
OK So not such a stupid question then. But now I probably have one. I've
knocked together a basic ASP.net website to show someone. But I wnat to show
them without having to run Visual Studio.net. Currently I press f5 to run
the web application, but I want to be able to just go to a URL without
having to run VS first.
How do I do this?
Kind regards
Dave
"Dave Smithz" <SPAM FREE WORLD> wrote in message
news:417fb0f2$1@.news1.homechoice.co.uk...
> "Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
> news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
> this. There are
> OK So not such a stupid question then. But now I probably have one. I've
> knocked together a basic ASP.net website to show someone. But I wnat to
> show
> them without having to run Visual Studio.net. Currently I press f5 to run
> the web application, but I want to be able to just go to a URL without
> having to run VS first.
> How do I do this?
What happens if you just go to the URL?
--
John Saunders
"John Saunders" <johnwsaundersiii@.hotmail.com> wrote in message >
> What happens if you just go to the URL?
> --
> John Saunders
errrr, it seems to work now. But I tell you it didn't before! ;)
Cheers
Newbie: How to duplicate a webform (including code) - Im confused.
I am sure there is a very simple answer to this question. But how does one
duplicate a webform in ASP.net? E.g. I have a webform that has standard
basic functionality for my whole web application (e.g. a navigation bar and
general layout). I want to copy this form many times as it is the template
for each page within my application.
However, when I use "save as" and save the webform as a different name,
things do not go as planned. Also I want all the underlying code to be
copied as well (e.g. so if I use a link button, on my first page, I want the
underlying code for that button to also copy through to the duplicate page).
So how is this achieved?
I'm probably going to be told there is a better way of having a template
page as well. This information will be useful as well, but for the time
being, duplicating manually a template page will do fine.
Kind regards
Dave.Dave, in ASP.NET 1.x, there's not a real easy way to do this. There are
Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
but these have poor tool support in VS.NET 2002/2003.
Fortunately this becomes much less of a pain with ASP.NET 2.0 and Visual
Studio 2005... but for the time being, it's not as easy as it *should*
be. But do check out Master Pages in ASP.NET 1.x, it's better than just
copying and pasting code around on each page...
Dave Smithz wrote:
> I am sure there is a very simple answer to this question. But how does one
> duplicate a webform in ASP.net? E.g. I have a webform that has standard
> basic functionality for my whole web application (e.g. a navigation bar and
> general layout). I want to copy this form many times as it is the template
> for each page within my application.
> However, when I use "save as" and save the webform as a different name,
> things do not go as planned. Also I want all the underlying code to be
> copied as well (e.g. so if I use a link button, on my first page, I want the
> underlying code for that button to also copy through to the duplicate page).
> So how is this achieved?
> I'm probably going to be told there is a better way of having a template
> page as well. This information will be useful as well, but for the time
> being, duplicating manually a template page will do fine.
--
Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com
* When you think ASP.NET, think 4GuysFromRolla.com!
"Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
this. There are
> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
> but these have poor tool support in VS.NET 2002/2003.
OK So not such a stupid question then. But now I probably have one. I've
knocked together a basic ASP.net website to show someone. But I wnat to show
them without having to run Visual Studio.net. Currently I press f5 to run
the web application, but I want to be able to just go to a URL without
having to run VS first.
How do I do this?
Kind regards
Dave
"John Saunders" <johnwsaundersiii@.hotmail.com> wrote in message >
> What happens if you just go to the URL?
> --
> John Saunders
errrr, it seems to work now. But I tell you it didn't before! ;)
Cheers
"Dave Smithz" <SPAM FREE WORLD> wrote in message
news:417fb0f2$1@.news1.homechoice.co.uk...
> "Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
> news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
> this. There are
>> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
>> but these have poor tool support in VS.NET 2002/2003.
> OK So not such a stupid question then. But now I probably have one. I've
> knocked together a basic ASP.net website to show someone. But I wnat to
> show
> them without having to run Visual Studio.net. Currently I press f5 to run
> the web application, but I want to be able to just go to a URL without
> having to run VS first.
> How do I do this?
What happens if you just go to the URL?
--
John Saunders
Newbie: how to handle large response.write blocks
Is there a way to abbreviate the aspx below? Specifically, is there a
way to eliminate the response.write syntax and escaped characters?
<%
if (MyObject.SomeBoolean)
{
Response.Write("<div class=\"myclass\">");
Response.Write("You may have won 1,000,000 dollars...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
else
{
Response.Write("<div class=\"error\">");
Response.Write("You should buy more magazines...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
%>
Thanks.
BrianIn C#, Not. If you want to have a literal quote in a string you have to plac
e
the \ escape before it.
Regarding not having to type Response.Write so much, try stuffing all your
strings into a StringBuilder instance. At the end, you can write one time:
Response.Write(myStringBuilder.ToString());
Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Brian F" wrote:
> Hi everyone -
> Is there a way to abbreviate the aspx below? Specifically, is there a
> way to eliminate the response.write syntax and escaped characters?
> <%
> if (MyObject.SomeBoolean)
> {
> Response.Write("<div class=\"myclass\">");
> Response.Write("You may have won 1,000,000 dollars...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> else
> {
> Response.Write("<div class=\"error\">");
> Response.Write("You should buy more magazines...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> %>
> Thanks.
> Brian
>
Newbie: how to handle large response.write blocks
Is there a way to abbreviate the aspx below? Specifically, is there a
way to eliminate the response.write syntax and escaped characters?
<%
if (MyObject.SomeBoolean)
{
Response.Write("<div class=\"myclass\">");
Response.Write("You may have won 1,000,000 dollars...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
else
{
Response.Write("<div class=\"error\">");
Response.Write("You should buy more magazines...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
%
Thanks.
BrianIn C#, Not. If you want to have a literal quote in a string you have to place
the \ escape before it.
Regarding not having to type Response.Write so much, try stuffing all your
strings into a StringBuilder instance. At the end, you can write one time:
Response.Write(myStringBuilder.ToString());
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Brian F" wrote:
> Hi everyone -
> Is there a way to abbreviate the aspx below? Specifically, is there a
> way to eliminate the response.write syntax and escaped characters?
> <%
> if (MyObject.SomeBoolean)
> {
> Response.Write("<div class=\"myclass\">");
> Response.Write("You may have won 1,000,000 dollars...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> else
> {
> Response.Write("<div class=\"error\">");
> Response.Write("You should buy more magazines...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> %>
> Thanks.
> Brian
>
newbie: how to print stuff at the shell using C# while at programming in asp.net
I want to able to see the certain value within the code itself. And I'm unable to use asp:label control.
Is there's any way I can print stuff on the shell so I can keep track of where I'm at with my varable?
I tried Console.Write(temp); but it didn't seem to work :(
TIA
Use one of the System.Diagnostics.Debug.Writexxx() methods. These will appear in the Output Window in Visual Studio as you run the site under the debugger.
Alternatively, use the HttpContext.Current.Trace.Write() method, and this will put output into the ASP.NET Trace, which you can either see on the page or via the trace.axd handler.
Thank you very much DMW, System.Diagnostics.Debug.Writexxx() is useful
case close
Newbie: how to navigate from one to another asp in the project
I have two asp-pages in my project.
There is a task on the first one, when the solution of the task ok, then
should the second page come. I made a menu for this. If the task solution
ok, then becomes the menu visible. Is it possible to activate automatically
the menu if the task solution ok? I mean, without the click on it? It it
possible to do all this simplier? I think somethink like this:
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click
If MySolution=true then
MySecondASPpage should be shown (what to entere here??)
end if
end sub
Thanks
BarbaraYou may want to use Response.Redirect("PageNameHere")
- V
Barbara Schmidt wrote:
Quote:
Originally Posted by
Hallo everybody!
I have two asp-pages in my project.
There is a task on the first one, when the solution of the task ok, then
should the second page come. I made a menu for this. If the task solution
ok, then becomes the menu visible. Is it possible to activate automatically
the menu if the task solution ok? I mean, without the click on it? It it
possible to do all this simplier? I think somethink like this:
>
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click
>
If MySolution=true then
>
MySecondASPpage should be shown (what to entere here??)
>
end if
>
end sub
>
>
>
Thanks
>
Barbara
Newbie: How to upload and save images using ASP.NET web forms (C#)
I need to upload images in my web application using ASP.NET web forms
(written in C#). Since i have never done this before, i am unsure what is the
best method.
I assume there are two options:
1). Upload the images and save the files directory to the windows file
system. However, i assume this poses a security risk, as the file directory
will require write permissions.
2). Save the images (as objects?) in the SQL SERVER database.
Can anyone suggest the best way to do this? And, if possible, point me to
some sample code or artciles which explain how to do this.
Thanks!Charlie,
check out the following article:
http://www.codeproject.com/aspnet/fileupload.asp
I prefer to save files in the database but it depends on your needs.
If you need to save hundred thousands of files and decide that you want to
save them on your hard disk make sure to distribute them on different
directories. What you could do is that you assign a guid to each file and
create your directory structure accordingly.
Example:
You have five files with the following guids
0A59E8D6-0AE5-475B-8698-814C2C712029
F16CE1B1-56D0-42E6-9463-A58D553CC289
D90C27C7 -8BD9-4F47-8CFE-DE9D240AD136
370B6080-DF06-4DDE-BB5E-85264B8AE48B
861DC387-FDC7-4A4F-B0C3-9EA6734A562A
You could now create a directory like the following:
0A59E8D6\0AE5\475B\8698\814C2C712029
F16CE1B1\56D0\42E6\9463\A58D553CC289
D90C27C7 \8BD9\4F47\8CFE\DE9D240AD136
370B6080\DF06\4DDE\BB5E\85264B8AE48B
861DC387\FDC7\4A4F\B0C3\9EA6734A562A
HTHs
Daniel
"charliewest" <charliewest@.discussions.microsoft.com> schrieb im Newsbeitrag
news:E6DD7087-DC4F-4E78-9741-0EF7F76883B6@.microsoft.com...
> Hello -
> I need to upload images in my web application using ASP.NET web forms
> (written in C#). Since i have never done this before, i am unsure what is
> the
> best method.
> I assume there are two options:
> 1). Upload the images and save the files directory to the windows file
> system. However, i assume this poses a security risk, as the file
> directory
> will require write permissions.
> 2). Save the images (as objects?) in the SQL SERVER database.
> Can anyone suggest the best way to do this? And, if possible, point me to
> some sample code or artciles which explain how to do this.
> Thanks!
Newbie: How to start
I have a html page with a form. How can I start turning this into an asp.net
page to including validation and submit processing?
Thanks
Regards
YahyaHey,
Well first things first. Create a web project if you are using Visual
Studio. If not .. you will need to work a bit more and create a virtual
directory and an aspx page. Similar to a normal html page but with lot of
extra tags... Get yourself a good asp.net book.
Now copy the html body and paste it in the aspx file. When you double a html
object like button or image it will be converted to equivalent web control
Have fun learning.. its fun..
Hermit Dave
"John" <john@.nospam.infovis.co.uk> wrote in message
news:%23neTBVQvDHA.2464@.TK2MSFTNGP12.phx.gbl...
> Hi
> I have a html page with a form. How can I start turning this into an
asp.net
> page to including validation and submit processing?
> Thanks
> Regards
>
> Yahya
newbie: HTTP and URIs
I'm quite new to this, so please excuse trivial questions:
- Is there any function (int the .net framework) that gives me an
enumeration of all URIs in a http stream (passed as e.g. a string)? If not,
how could I achieve such a thing?
- Really trivial, but to make sure: What does the string "/.../" in an URL
mean? I'd suspect some directory operation, but I dunno exactly...
- I'm currently using the HttpUtility.UrlDecode() function to decode some
http URIs and one thing stroke me in particular: The string
[...]"test.exe?/c+xtsr" is decoded to "test.exe?/c xtsr", missing the "+".
When I use the System.Uri class for the decoding the "+" remains...Does
anyone know why?
Thanks for reading till end and thanks in advance
PeterHi Peter,
No question is trivial if you don't know the answer to it! :)
> - Is there any function (int the .net framework) that gives me an
> enumeration of all URIs in a http stream (passed as e.g. a string)? If
> not,
> how could I achieve such a thing?
Not sure what you mean by this. You can find URLs in an HTML document by
using Regular Expressions. The HTML document is a string.
> - Really trivial, but to make sure: What does the string "/.../" in an
> URL
> mean? I'd suspect some directory operation, but I dunno exactly...
Is that the exact string you saw in a URL? I've never seen it before.
The following link to the W3C should help":
http://www.gbiv.com/protocols/uri/rfc/rfc3986.html
> - I'm currently using the HttpUtility.UrlDecode() function to decode some
> http URIs and one thing stroke me in particular: The string
> [...]"test.exe?/c+xtsr" is decoded to "test.exe?/c xtsr", missing the "+".
> When I use the System.Uri class for the decoding the "+" remains...Does
> anyone know why?
The "+" character is a URL-Encoding for a space (which is an illegal URL
character).
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S

"Peter Schmitz" <PeterSchmitz@.discussions.microsoft.com> wrote in message
news:A10E415D-10FA-4F56-BA27-D950B8F6BCDA@.microsoft.com...
> Hi,
> I'm quite new to this, so please excuse trivial questions:
> - Is there any function (int the .net framework) that gives me an
> enumeration of all URIs in a http stream (passed as e.g. a string)? If
> not,
> how could I achieve such a thing?
> - Really trivial, but to make sure: What does the string "/.../" in an
> URL
> mean? I'd suspect some directory operation, but I dunno exactly...
> - I'm currently using the HttpUtility.UrlDecode() function to decode some
> http URIs and one thing stroke me in particular: The string
> [...]"test.exe?/c+xtsr" is decoded to "test.exe?/c xtsr", missing the "+".
> When I use the System.Uri class for the decoding the "+" remains...Does
> anyone know why?
> Thanks for reading till end and thanks in advance
> Peter
>
newbie: HTTP and URIs
I'm quite new to this, so please excuse trivial questions:
- Is there any function (int the .net framework) that gives me an
enumeration of all URIs in a http stream (passed as e.g. a string)? If not,
how could I achieve such a thing?
- Really trivial, but to make sure: What does the string "/.../" in an URL
mean? I'd suspect some directory operation, but I dunno exactly...
- I'm currently using the HttpUtility.UrlDecode() function to decode some
http URIs and one thing stroke me in particular: The string
[...]"test.exe?/c+xtsr" is decoded to "test.exe?/c xtsr", missing the "+".
When I use the System.Uri class for the decoding the "+" remains...Does
anyone know why?
Thanks for reading till end and thanks in advance
PeterHi Peter,
No question is trivial if you don't know the answer to it! :)
> - Is there any function (int the .net framework) that gives me an
> enumeration of all URIs in a http stream (passed as e.g. a string)? If
> not,
> how could I achieve such a thing?
Not sure what you mean by this. You can find URLs in an HTML document by
using Regular Expressions. The HTML document is a string.
> - Really trivial, but to make sure: What does the string "/.../" in an
> URL
> mean? I'd suspect some directory operation, but I dunno exactly...
Is that the exact string you saw in a URL? I've never seen it before.
The following link to the W3C should help":
http://www.gbiv.com/protocols/uri/rfc/rfc3986.html
> - I'm currently using the HttpUtility.UrlDecode() function to decode some
> http URIs and one thing stroke me in particular: The string
> [...]"test.exe?/c+xtsr" is decoded to "test.exe?/c xtsr", missing the "+".
> When I use the System.Uri class for the decoding the "+" remains...Does
> anyone know why?
The "+" character is a URL-Encoding for a space (which is an illegal URL
character).
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
"Peter Schmitz" <PeterSchmitz@.discussions.microsoft.com> wrote in message
news:A10E415D-10FA-4F56-BA27-D950B8F6BCDA@.microsoft.com...
> Hi,
> I'm quite new to this, so please excuse trivial questions:
> - Is there any function (int the .net framework) that gives me an
> enumeration of all URIs in a http stream (passed as e.g. a string)? If
> not,
> how could I achieve such a thing?
> - Really trivial, but to make sure: What does the string "/.../" in an
> URL
> mean? I'd suspect some directory operation, but I dunno exactly...
> - I'm currently using the HttpUtility.UrlDecode() function to decode some
> http URIs and one thing stroke me in particular: The string
> [...]"test.exe?/c+xtsr" is decoded to "test.exe?/c xtsr", missing the "+".
> When I use the System.Uri class for the decoding the "+" remains...Does
> anyone know why?
> Thanks for reading till end and thanks in advance
> Peter
newbie: HTML controls vs Web controls
I am learning .NET 2.0. And I have a question: when to use web-controls and
when to use HTML controls?
/RAM/Hi,
R.A.M. wrote:
> Hello,
> I am learning .NET 2.0. And I have a question: when to use web-controls an
d
> when to use HTML controls?
> /RAM/
The System.Web.UI.HtmlControls namespace is for HTML controls, in the
sense that they are declared on the page using standard HTML tags, for
example "input", "select", "textarea", etc...
The System.Web.UI.WebControls namespace is for ASP.NET controls, which
are declared on the page with an "asp:" prefix, for example "asp:Checkbox".
The different is that in the first case, they're client-side controls.
You use them on the server in order to set attributes, scripts, etc...
which are executed on the client. In the second case, however, (and
while you can also influence the way they will be rendered on the
client), the events you wire them to are executed on the server
(involving a postback).
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
It depends on what you are more comfortable with. If you come from Windows
application background, you will find that web controls are more friendly
and they are a less dramatic change from your previous experience.. If you
come from html background you will like html controls. As you master your
asp.net skills, you will likely lean more towards html controls as they give
you better control over client-side functionality.
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"R.A.M." <r_ahimsa_m@.poczta.onet.pl> wrote in message
news:ejgq05$8h1$1@.news.onet.pl...
> Hello,
> I am learning .NET 2.0. And I have a question: when to use web-controls
> and when to use HTML controls?
> /RAM/
>
newbie: HTML controls vs Web controls
I am learning .NET 2.0. And I have a question: when to use web-controls and
when to use HTML controls?
/RAM/Hi,
R.A.M. wrote:
Quote:
Originally Posted by
Hello,
I am learning .NET 2.0. And I have a question: when to use web-controls and
when to use HTML controls?
/RAM/
The System.Web.UI.HtmlControls namespace is for HTML controls, in the
sense that they are declared on the page using standard HTML tags, for
example "input", "select", "textarea", etc...
The System.Web.UI.WebControls namespace is for ASP.NET controls, which
are declared on the page with an "asp:" prefix, for example "asp:Checkbox".
The different is that in the first case, they're client-side controls.
You use them on the server in order to set attributes, scripts, etc...
which are executed on the client. In the second case, however, (and
while you can also influence the way they will be rendered on the
client), the events you wire them to are executed on the server
(involving a postback).
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
It depends on what you are more comfortable with. If you come from Windows
application background, you will find that web controls are more friendly
and they are a less dramatic change from your previous experience.. If you
come from html background you will like html controls. As you master your
asp.net skills, you will likely lean more towards html controls as they give
you better control over client-side functionality.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"R.A.M." <r_ahimsa_m@.poczta.onet.plwrote in message
news:ejgq05$8h1$1@.news.onet.pl...
Quote:
Originally Posted by
Hello,
I am learning .NET 2.0. And I have a question: when to use web-controls
and when to use HTML controls?
/RAM/
>
newbie: I wonder if this is possible in asp.net 2.0
asp.net 2.0
As far as I know it's possible to search the users registrered at a asp.net
2.0 web portal using either username or e-mail.
But what about the custom profile properties which can be configured in
web.config? Can they be searched too? I guess it can by using foreach loop
and test the contents on every user object.. but I thought maybe there was a
cleaner and faster way to do it...
Lets say for example these are custom profile settings in web.config. any
suggestion on how to search them? Lets say the search should return all
users containing the phrase "Lets" in lastname? or all users of a specific
gender?
<profile enabled="true">
<properties>
<add name="FirstName" type="string"/>
<add name="LastName" type="string"/>
<add name="Gender" type="string"/>
<add name="BirthDate" type="DateTime"/>
</properties>
</profile>
Best RegardsThis article should help, and even fleshes out some of the sample code
provided by one of the MS people for it:
http://www.eggheadcafe.com/articles/20060731.asp
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Jeff" wrote:
Quote:
Originally Posted by
Hey
>
asp.net 2.0
>
As far as I know it's possible to search the users registrered at a asp.net
2.0 web portal using either username or e-mail.
>
But what about the custom profile properties which can be configured in
web.config? Can they be searched too? I guess it can by using foreach loop
and test the contents on every user object.. but I thought maybe there was a
cleaner and faster way to do it...
>
Lets say for example these are custom profile settings in web.config. any
suggestion on how to search them? Lets say the search should return all
users containing the phrase "Lets" in lastname? or all users of a specific
gender?
<profile enabled="true">
<properties>
<add name="FirstName" type="string"/>
<add name="LastName" type="string"/>
<add name="Gender" type="string"/>
<add name="BirthDate" type="DateTime"/>
</properties>
</profile>
>
Best Regards
>
>
>
Newbie: I need some tips
OS: XP pro sp2
I need to create a asp.net page which will receive data sent to it via
GET... The data sent into the page is a number, this number should be added
together with the numbers sent into the page by other users...
for example:
user A: http://localhost/test.aspx?value=1
and
user B: http://localhost/test.aspx?value=2
if user C want to retrieve this value, he should get the value 3 (1 +2)
Here som of the code in my Global.asax.cs:
public class Global : System.Web.HttpApplication
{
/// <summary>
/// Required designer variable.
/// </summary>
///
int b;
protected void Application_Start(Object sender, EventArgs e)
{
b ++;
Application.Add("test", b);
}
As you can see from my code above, I'm trying to fix this problem using
HttpApplication... Is that the correct approach? If it isn't, what is the
correct approach then??
JeffUsing Application is fine...but you should be putting it in the
Application_BeginRequest method, or the Page_Load of test.
Application_Start fires once and only once so it'll never add. It's hard to
advise without knowing more in detail. I'd be tempted to scoping this out
to the test.aspx page.
The following code will in no way compile, but should give you a general
idea
page_load
int userInput;
try{
userInput = Int32.Parse(Request.QueryString["value"]);
}catch (Exception ex){
if (!(ex is FormatException) && !(ex is InvalidCastException) && !(ex
is OverflowException))
throw;
}
object o = Application["totalCount"]
if (Application["totalCount"] != null){
((int)Application["totalCount"]) += userInput
}else{
Application["totalCount"] = userInput;
}
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23KAabkfWFHA.3716@.TK2MSFTNGP12.phx.gbl...
> IDE vs .NET 2003
> OS: XP pro sp2
> I need to create a asp.net page which will receive data sent to it via
> GET... The data sent into the page is a number, this number should be
> added
> together with the numbers sent into the page by other users...
> for example:
> user A: http://localhost/test.aspx?value=1
> and
> user B: http://localhost/test.aspx?value=2
> if user C want to retrieve this value, he should get the value 3 (1 +2)
> Here som of the code in my Global.asax.cs:
> public class Global : System.Web.HttpApplication
> {
> /// <summary>
> /// Required designer variable.
> /// </summary>
> ///
> int b;
> protected void Application_Start(Object sender, EventArgs e)
> {
> b ++;
> Application.Add("test", b);
> }
> As you can see from my code above, I'm trying to fix this problem using
> HttpApplication... Is that the correct approach? If it isn't, what is the
> correct approach then??
> Jeff
Newbie: I need some tips
OS: XP pro sp2
I need to create a asp.net page which will receive data sent to it via
GET... The data sent into the page is a number, this number should be added
together with the numbers sent into the page by other users...
for example:
user A: http://localhost/test.aspx?value=1
and
user B: http://localhost/test.aspx?value=2
if user C want to retrieve this value, he should get the value 3 (1 +2)
Here som of the code in my Global.asax.cs:
public class Global : System.Web.HttpApplication
{
/// <summary>
/// Required designer variable.
/// </summary>
///
int b;
protected void Application_Start(Object sender, EventArgs e)
{
b ++;
Application.Add("test", b);
}
As you can see from my code above, I'm trying to fix this problem using
HttpApplication... Is that the correct approach? If it isn't, what is the
correct approach then'
JeffUsing Application is fine...but you should be putting it in the
Application_BeginRequest method, or the Page_Load of test.
Application_Start fires once and only once so it'll never add. It's hard to
advise without knowing more in detail. I'd be tempted to scoping this out
to the test.aspx page.
The following code will in no way compile, but should give you a general
idea
page_load
int userInput;
try{
userInput = Int32.Parse(Request.QueryString["value"]);
}catch (Exception ex){
if (!(ex is FormatException) && !(ex is InvalidCastException) && !(ex
is OverflowException))
throw;
}
object o = Application["totalCount"]
if (Application["totalCount"] != null){
((int)Application["totalCount"]) += userInput
}else{
Application["totalCount"] = userInput;
}
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23KAabkfWFHA.3716@.TK2MSFTNGP12.phx.gbl...
> IDE vs .NET 2003
> OS: XP pro sp2
> I need to create a asp.net page which will receive data sent to it via
> GET... The data sent into the page is a number, this number should be
> added
> together with the numbers sent into the page by other users...
> for example:
> user A: http://localhost/test.aspx?value=1
> and
> user B: http://localhost/test.aspx?value=2
> if user C want to retrieve this value, he should get the value 3 (1 +2)
> Here som of the code in my Global.asax.cs:
> public class Global : System.Web.HttpApplication
> {
> /// <summary>
> /// Required designer variable.
> /// </summary>
> ///
> int b;
> protected void Application_Start(Object sender, EventArgs e)
> {
> b ++;
> Application.Add("test", b);
> }
> As you can see from my code above, I'm trying to fix this problem using
> HttpApplication... Is that the correct approach? If it isn't, what is the
> correct approach then'
> Jeff
>
>
newbie: I don't want my .aspx and .cs files to have the source viewable by the client
right to the binaries, not the source code. Is there a way to compile it so
that I just give them dll's? or do they need the .aspx pages. I read
somewhere that I could probably make assemblies (excuse my bad terminology)
of the source code, but that it is quiet easy to disassemble the assemblies,
so that does not seem to afford read protection.
or am I just all

thanksYou need to give them the ASPX pages and the compiled DLLs, but you do not
need to give them the .CS source code files.
If they are unethical they could decombile the DLLs to get a rough
approximation of the source code, but you can thwart them with an
Obfuscator.
Visual Studio 2003 has a basic built in obfuscator, but for 2002 you'll need
a 3rd party solution.
Here's more information on obfuscators:
http://www.abderaware.com/WhitePapers/Obfuscator.htm
http://www.preemptive.com/dotfuscator/index.html
http://www.devx.com/SummitDays/Article/11351
http://www.lesser-software.com/ilobf.htm
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Seth Broomer" <asdf@.asdsd.com> wrote in message
news:eWLgn06jEHA.1656@.TK2MSFTNGP09.phx.gbl...
> I'm creating a C# .net project, for a client. However they only have the
> right to the binaries, not the source code. Is there a way to compile it
> so
> that I just give them dll's? or do they need the .aspx pages. I read
> somewhere that I could probably make assemblies (excuse my bad
> terminology)
> of the source code, but that it is quiet easy to disassemble the
> assemblies,
> so that does not seem to afford read protection.
> or am I just all

> thanks
>
newbie: I dont want my .aspx and .cs files to have the source viewable by the client
right to the binaries, not the source code. Is there a way to compile it so
that I just give them dll's? or do they need the .aspx pages. I read
somewhere that I could probably make assemblies (excuse my bad terminology)
of the source code, but that it is quiet easy to disassemble the assemblies,
so that does not seem to afford read protection.
or am I just all confused over nothing!
thanksYou need to give them the ASPX pages and the compiled DLLs, but you do not
need to give them the .CS source code files.
If they are unethical they could decombile the DLLs to get a rough
approximation of the source code, but you can thwart them with an
Obfuscator.
Visual Studio 2003 has a basic built in obfuscator, but for 2002 you'll need
a 3rd party solution.
Here's more information on obfuscators:
http://www.abderaware.com/WhitePapers/Obfuscator.htm
http://www.preemptive.com/dotfuscator/index.html
http://www.devx.com/SummitDays/Article/11351
http://www.lesser-software.com/ilobf.htm
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Seth Broomer" <asdf@.asdsd.com> wrote in message
news:eWLgn06jEHA.1656@.TK2MSFTNGP09.phx.gbl...
> I'm creating a C# .net project, for a client. However they only have the
> right to the binaries, not the source code. Is there a way to compile it
> so
> that I just give them dll's? or do they need the .aspx pages. I read
> somewhere that I could probably make assemblies (excuse my bad
> terminology)
> of the source code, but that it is quiet easy to disassemble the
> assemblies,
> so that does not seem to afford read protection.
> or am I just all confused over nothing!
> thanks
FYI - Just remember there are Deobfuscator out there. But at least you are
taking some sort of measure to secure the DLLs.
"Steve C. Orr [MVP, MCSD]" wrote:
> You need to give them the ASPX pages and the compiled DLLs, but you do not
> need to give them the .CS source code files.
> If they are unethical they could decombile the DLLs to get a rough
> approximation of the source code, but you can thwart them with an
> Obfuscator.
> Visual Studio 2003 has a basic built in obfuscator, but for 2002 you'll need
> a 3rd party solution.
> Here's more information on obfuscators:
> http://www.abderaware.com/WhitePapers/Obfuscator.htm
> http://www.preemptive.com/dotfuscator/index.html
> http://www.devx.com/SummitDays/Article/11351
> http://www.lesser-software.com/ilobf.htm
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
> "Seth Broomer" <asdf@.asdsd.com> wrote in message
> news:eWLgn06jEHA.1656@.TK2MSFTNGP09.phx.gbl...
> > I'm creating a C# .net project, for a client. However they only have the
> > right to the binaries, not the source code. Is there a way to compile it
> > so
> > that I just give them dll's? or do they need the .aspx pages. I read
> > somewhere that I could probably make assemblies (excuse my bad
> > terminology)
> > of the source code, but that it is quiet easy to disassemble the
> > assemblies,
> > so that does not seem to afford read protection.
> > or am I just all confused over nothing!
> > thanks
>
newbie: image problems again
asp.net 2.0
my problem is that on a webpage am I trying to dynamically display the image
a user has uploaded. But the webpage doesn't display the image. The browser
displays the standard image telling that image not found / broken image link
etc...
This is the code which saves the image to hard drive...:
fullsizeImage.Save(Server.MapPath("~/Images/Fullsize/" + Profile.UserName +
".jpeg"));
This is my code for displaying the image, it's in Page_Load event of
webpage:
imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/" + Profile.UserName
+ ".jpeg");
The image exist in that folder
Any suggestions to this error?
JeffHi Jeff,
does this variable "Profile.UserName" really exist when you try to load the
image. Did you place an exception-handler around the loading-method?
Bye,
--
Matthias Pieroth
www.codegod.de - The Page for .NET-developers
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23qlAzL5nGHA.1808@.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
hey
>
asp.net 2.0
>
my problem is that on a webpage am I trying to dynamically display the
image a user has uploaded. But the webpage doesn't display the image. The
browser displays the standard image telling that image not found / broken
image link etc...
>
This is the code which saves the image to hard drive...:
fullsizeImage.Save(Server.MapPath("~/Images/Fullsize/" + Profile.UserName
+ ".jpeg"));
>
This is my code for displaying the image, it's in Page_Load event of
webpage:
imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/" +
Profile.UserName + ".jpeg");
>
The image exist in that folder
>
Any suggestions to this error?
>
Jeff
>
Hey
it looks like Profile.UserName is empty...
But this code doesn't work either:
imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/test.jpeg");
I've also tryed this (setting it directly in the source, not the code
behind):
src='<%# Eval("~/Images/Fullsize/test.jpeg") %>'
Without any success...
any suggestions?
Jeff
"Matthias Pieroth" <piermat2001@.yahoo.dewrote in message
news:e8elch$p0k$02$1@.news.t-online.com...
Quote:
Originally Posted by
Hi Jeff,
>
does this variable "Profile.UserName" really exist when you try to load
the image. Did you place an exception-handler around the loading-method?
>
Bye,
>
--
Matthias Pieroth
www.codegod.de - The Page for .NET-developers
>
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23qlAzL5nGHA.1808@.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
>hey
>>
>asp.net 2.0
>>
>my problem is that on a webpage am I trying to dynamically display the
>image a user has uploaded. But the webpage doesn't display the image. The
>browser displays the standard image telling that image not found / broken
>image link etc...
>>
>This is the code which saves the image to hard drive...:
>fullsizeImage.Save(Server.MapPath("~/Images/Fullsize/" + Profile.UserName
>+ ".jpeg"));
>>
>This is my code for displaying the image, it's in Page_Load event of
>webpage:
>imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/" +
>Profile.UserName + ".jpeg");
>>
>The image exist in that folder
>>
>Any suggestions to this error?
>>
>Jeff
>>
>
>
Hi Jeff,
I am not sure what your problem is, but try one of these two things:
1. If you are using something like VS.Net, then simply try to locate a
test image using the properties grid of the Image Control. And then try
to run your page and see if it works.
2. try printing the path you are trying to assign to the ImageUrl
property by using a Response.Write() from the code behind.
So basically Response.Write(Server.MapPath("~\....
I have a feeling you are doing a bit too much in trying to assign a
path to the ImageUrl property.
- V
Jeff wrote:
Quote:
Originally Posted by
Hey
>
it looks like Profile.UserName is empty...
But this code doesn't work either:
imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/test.jpeg");
>
I've also tryed this (setting it directly in the source, not the code
behind):
src='<%# Eval("~/Images/Fullsize/test.jpeg") %>'
Without any success...
>
any suggestions?
>
Jeff
>
>
"Matthias Pieroth" <piermat2001@.yahoo.dewrote in message
news:e8elch$p0k$02$1@.news.t-online.com...
Quote:
Originally Posted by
Hi Jeff,
does this variable "Profile.UserName" really exist when you try to load
the image. Did you place an exception-handler around the loading-method?
Bye,
--
Matthias Pieroth
www.codegod.de - The Page for .NET-developers
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23qlAzL5nGHA.1808@.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
hey
>
asp.net 2.0
>
my problem is that on a webpage am I trying to dynamically display the
image a user has uploaded. But the webpage doesn't display the image. The
browser displays the standard image telling that image not found / broken
image link etc...
>
This is the code which saves the image to hard drive...:
fullsizeImage.Save(Server.MapPath("~/Images/Fullsize/" + Profile.UserName
+ ".jpeg"));
>
This is my code for displaying the image, it's in Page_Load event of
webpage:
imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/" +
Profile.UserName + ".jpeg");
>
The image exist in that folder
>
Any suggestions to this error?
>
Jeff
>
The path is
C:\Documents and Settings\Jeff\My Documents\Visual Studio
2005\WebSites\BN\Images\Fullsize\test.jpeg
I've checked and path is correct, but the path contains spaces...
I'm not sure about it but maybe the browser need to know if this is a
picture ("image/thumb")?
Jeff
"V" <vaibhav.gadodia@.gmail.comwrote in message
news:1152051114.522719.324780@.a14g2000cwb.googlegr oups.com...
Quote:
Originally Posted by
Hi Jeff,
>
I am not sure what your problem is, but try one of these two things:
1. If you are using something like VS.Net, then simply try to locate a
test image using the properties grid of the Image Control. And then try
to run your page and see if it works.
>
2. try printing the path you are trying to assign to the ImageUrl
property by using a Response.Write() from the code behind.
So basically Response.Write(Server.MapPath("~\....
>
I have a feeling you are doing a bit too much in trying to assign a
path to the ImageUrl property.
>
- V
>
Jeff wrote:
Quote:
Originally Posted by
>Hey
>>
>it looks like Profile.UserName is empty...
>But this code doesn't work either:
>imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/test.jpeg");
>>
>I've also tryed this (setting it directly in the source, not the code
>behind):
>src='<%# Eval("~/Images/Fullsize/test.jpeg") %>'
>Without any success...
>>
>any suggestions?
>>
>Jeff
>>
>>
>"Matthias Pieroth" <piermat2001@.yahoo.dewrote in message
>news:e8elch$p0k$02$1@.news.t-online.com...
Quote:
Originally Posted by
Hi Jeff,
>
does this variable "Profile.UserName" really exist when you try to load
the image. Did you place an exception-handler around the
loading-method?
>
Bye,
>
--
Matthias Pieroth
www.codegod.de - The Page for .NET-developers
>
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23qlAzL5nGHA.1808@.TK2MSFTNGP02.phx.gbl...
>hey
>>
>asp.net 2.0
>>
>my problem is that on a webpage am I trying to dynamically display the
>image a user has uploaded. But the webpage doesn't display the image.
>The
>browser displays the standard image telling that image not found /
>broken
>image link etc...
>>
>This is the code which saves the image to hard drive...:
>fullsizeImage.Save(Server.MapPath("~/Images/Fullsize/" +
>Profile.UserName
>+ ".jpeg"));
>>
>This is my code for displaying the image, it's in Page_Load event of
>webpage:
>imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/" +
>Profile.UserName + ".jpeg");
>>
>The image exist in that folder
>>
>Any suggestions to this error?
>>
>Jeff
>>
>
>
>
It is possible that you may need to grant permission to the asp.net
process on that image directory. It might be a problem with the
security.
- V
Jeff wrote:
Quote:
Originally Posted by
The path is
C:\Documents and Settings\Jeff\My Documents\Visual Studio
2005\WebSites\BN\Images\Fullsize\test.jpeg
>
I've checked and path is correct, but the path contains spaces...
>
I'm not sure about it but maybe the browser need to know if this is a
picture ("image/thumb")?
>
>
>
>
Jeff
>
>
>
>
>
"V" <vaibhav.gadodia@.gmail.comwrote in message
news:1152051114.522719.324780@.a14g2000cwb.googlegr oups.com...
Quote:
Originally Posted by
Hi Jeff,
I am not sure what your problem is, but try one of these two things:
1. If you are using something like VS.Net, then simply try to locate a
test image using the properties grid of the Image Control. And then try
to run your page and see if it works.
2. try printing the path you are trying to assign to the ImageUrl
property by using a Response.Write() from the code behind.
So basically Response.Write(Server.MapPath("~\....
I have a feeling you are doing a bit too much in trying to assign a
path to the ImageUrl property.
- V
Jeff wrote:
Quote:
Originally Posted by
Hey
>
it looks like Profile.UserName is empty...
But this code doesn't work either:
imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/test.jpeg");
>
I've also tryed this (setting it directly in the source, not the code
behind):
src='<%# Eval("~/Images/Fullsize/test.jpeg") %>'
Without any success...
>
any suggestions?
>
Jeff
>
>
"Matthias Pieroth" <piermat2001@.yahoo.dewrote in message
news:e8elch$p0k$02$1@.news.t-online.com...
Hi Jeff,
does this variable "Profile.UserName" really exist when you try to load
the image. Did you place an exception-handler around the
loading-method?
Bye,
--
Matthias Pieroth
www.codegod.de - The Page for .NET-developers
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23qlAzL5nGHA.1808@.TK2MSFTNGP02.phx.gbl...
hey
>
asp.net 2.0
>
my problem is that on a webpage am I trying to dynamically display the
image a user has uploaded. But the webpage doesn't display the image.
The
browser displays the standard image telling that image not found /
broken
image link etc...
>
This is the code which saves the image to hard drive...:
fullsizeImage.Save(Server.MapPath("~/Images/Fullsize/" +
Profile.UserName
+ ".jpeg"));
>
This is my code for displaying the image, it's in Page_Load event of
webpage:
imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/" +
Profile.UserName + ".jpeg");
>
The image exist in that folder
>
Any suggestions to this error?
>
Jeff
>
I replaced this line:
imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/test.jpeg");
with this line
imgPicture.ImageUrl = "~/Images/Fullsize/test.jpeg";
And now it works
Thank you very much for helping me with this. The best thing with this
problem is that I've learned from it -maybe using Server.MapPath isn't
best all the times...
Best Regards!
Jeff
"V" <vaibhav.gadodia@.gmail.comwrote in message
news:1152057813.849114.308260@.m73g2000cwd.googlegr oups.com...
Quote:
Originally Posted by
It is possible that you may need to grant permission to the asp.net
process on that image directory. It might be a problem with the
security.
>
- V
Jeff wrote:
Quote:
Originally Posted by
>The path is
>C:\Documents and Settings\Jeff\My Documents\Visual Studio
>2005\WebSites\BN\Images\Fullsize\test.jpeg
>>
>I've checked and path is correct, but the path contains spaces...
>>
>I'm not sure about it but maybe the browser need to know if this is a
>picture ("image/thumb")?
>>
>>
>>
>>
>Jeff
>>
>>
>>
>>
>>
>"V" <vaibhav.gadodia@.gmail.comwrote in message
>news:1152051114.522719.324780@.a14g2000cwb.googlegr oups.com...
Quote:
Originally Posted by
Hi Jeff,
>
I am not sure what your problem is, but try one of these two things:
1. If you are using something like VS.Net, then simply try to locate a
test image using the properties grid of the Image Control. And then try
to run your page and see if it works.
>
2. try printing the path you are trying to assign to the ImageUrl
property by using a Response.Write() from the code behind.
So basically Response.Write(Server.MapPath("~\....
>
I have a feeling you are doing a bit too much in trying to assign a
path to the ImageUrl property.
>
- V
>
Jeff wrote:
>Hey
>>
>it looks like Profile.UserName is empty...
>But this code doesn't work either:
>imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/test.jpeg");
>>
>I've also tryed this (setting it directly in the source, not the code
>behind):
>src='<%# Eval("~/Images/Fullsize/test.jpeg") %>'
>Without any success...
>>
>any suggestions?
>>
>Jeff
>>
>>
>"Matthias Pieroth" <piermat2001@.yahoo.dewrote in message
>news:e8elch$p0k$02$1@.news.t-online.com...
Hi Jeff,
>
does this variable "Profile.UserName" really exist when you try to
load
the image. Did you place an exception-handler around the
loading-method?
>
Bye,
>
--
Matthias Pieroth
www.codegod.de - The Page for .NET-developers
>
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23qlAzL5nGHA.1808@.TK2MSFTNGP02.phx.gbl...
>hey
>>
>asp.net 2.0
>>
>my problem is that on a webpage am I trying to dynamically display
>the
>image a user has uploaded. But the webpage doesn't display the
>image.
>The
>browser displays the standard image telling that image not found /
>broken
>image link etc...
>>
>This is the code which saves the image to hard drive...:
>fullsizeImage.Save(Server.MapPath("~/Images/Fullsize/" +
>Profile.UserName
>+ ".jpeg"));
>>
>This is my code for displaying the image, it's in Page_Load event
>of
>webpage:
>imgPicture.ImageUrl = Server.MapPath("~/Images/Fullsize/" +
>Profile.UserName + ".jpeg");
>>
>The image exist in that folder
>>
>Any suggestions to this error?
>>
>Jeff
>>
>
>
>
>