Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Thursday, March 29, 2012

Newbie: How to display search results?

I am new to ASP.NET, so probably my question is very basic:

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: image problems again

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?

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
>>
>
>
>


>

Monday, March 26, 2012

newbie: My code crashes

hey

asp.net 2.0

I'm trying to make a webpage that shows a list of pictures. When the user
clicks on a picture, the user is redirected to another page in my website.
The links are generated at runtime

My code crashes during runtime because of a variable in the ItemDataBound
event is null. Below I show my problem code and maybe some of you could give
me a suggestion to what should do to fix this...

<td rowspan="2"><a id="LinkToProfile" href="http://links.10026.com/?link="><asp:Image ID="MemberPhoto"
runat="server" ImageAlign="Left" /></a></td>

System.Web.UI.HtmlControls.HtmlAnchor link = null;
link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.Find Control("LinkToProfile");
link.HRef = "../test.aspx?id=" + subscriber.UserName;

My code crashes because the variable "link" is null after this line "link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.Find Control("LinkToProfile");"

Any suggestions that may solve this problem are very welcome :-)

JeffThat is because there is no control with the id "LinkToProfile". You
have to put runat="server" in the tag to make it a server control.

Jeff wrote:

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
I'm trying to make a webpage that shows a list of pictures. When the user
clicks on a picture, the user is redirected to another page in my website.
The links are generated at runtime
>
My code crashes during runtime because of a variable in the ItemDataBound
event is null. Below I show my problem code and maybe some of you could give
me a suggestion to what should do to fix this...
>
>
<td rowspan="2"><a id="LinkToProfile" href="http://links.10026.com/?link="><asp:Image ID="MemberPhoto"
runat="server" ImageAlign="Left" /></a></td>
>
System.Web.UI.HtmlControls.HtmlAnchor link = null;
link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.Find Control("LinkToProfile");
link.HRef = "../test.aspx?id=" + subscriber.UserName;
>
My code crashes because the variable "link" is null after this line "link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.Find Control("LinkToProfile");"
>
Any suggestions that may solve this problem are very welcome :-)
>
Jeff
>
>


Why not dynamically generated ImageButtons and set the image and postbackUrl
on the control to do what you desire. You can then have complete control
without a lot of code and use a control that is designed to do both of the
tasks you desire.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23Pma5OmoGHA.5104@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
I'm trying to make a webpage that shows a list of pictures. When the user
clicks on a picture, the user is redirected to another page in my website.
The links are generated at runtime
>
My code crashes during runtime because of a variable in the ItemDataBound
event is null. Below I show my problem code and maybe some of you could
give me a suggestion to what should do to fix this...
>
>
<td rowspan="2"><a id="LinkToProfile" href="http://links.10026.com/?link="><asp:Image ID="MemberPhoto"
runat="server" ImageAlign="Left" /></a></td>
>
System.Web.UI.HtmlControls.HtmlAnchor link = null;
link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.Find Control("LinkToProfile");
link.HRef = "../test.aspx?id=" + subscriber.UserName;
>
My code crashes because the variable "link" is null after this line "link
=
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.Find Control("LinkToProfile");"
>
Any suggestions that may solve this problem are very welcome :-)
>
Jeff
>
>


Thanks for the advice, I will try it.

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamMwrote in
message news:Oax8NlqoGHA.4960@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Why not dynamically generated ImageButtons and set the image and
postbackUrl on the control to do what you desire. You can then have
complete control without a lot of code and use a control that is designed
to do both of the tasks you desire.
>
--
Gregory A. Beamer
>
*************************************************
Think Outside the Box!
*************************************************
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23Pma5OmoGHA.5104@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

>hey
>>
>asp.net 2.0
>>
>I'm trying to make a webpage that shows a list of pictures. When the user
>clicks on a picture, the user is redirected to another page in my
>website. The links are generated at runtime
>>
>My code crashes during runtime because of a variable in the ItemDataBound
>event is null. Below I show my problem code and maybe some of you could
>give me a suggestion to what should do to fix this...
>>
>>
><td rowspan="2"><a id="LinkToProfile" href="http://links.10026.com/?link="><asp:Image ID="MemberPhoto"
>runat="server" ImageAlign="Left" /></a></td>
>>
>System.Web.UI.HtmlControls.HtmlAnchor link = null;
>link =
>(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.Find Control("LinkToProfile");
>link.HRef = "../test.aspx?id=" + subscriber.UserName;
>>
>My code crashes because the variable "link" is null after this line "link
>=
>(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.Find Control("LinkToProfile");"
>>
>Any suggestions that may solve this problem are very welcome :-)
>>
>Jeff
>>
>>


>
>

Newbie: Open other form when link is clicked

I have a hyperlink on my Web form (home.aspx). I want to open another
form (Login.aspx) when user clicks this link. How to do this? I also
want to maintain site map when another form gets opened."Rohit" <rpk.general@.gmail.comwrote in message
news:1192811576.682143.41250@.e34g2000pro.googlegro ups.com...

Quote:

Originally Posted by

I have a hyperlink on my Web form (home.aspx). I want to open another
form (Login.aspx) when user clicks this link. How to do this?


Well, the obvious answer is to change the hyperlink to point to Login.aspx
instead of home.aspx, but I guess that's not what you really mean...

Can you explain in a bit more detail what you're trying to do...

--
Mark Rae
ASP.NET MVP
http://www.markrae.net
In the client-side click event of the link, call window.open ('popup.aspx");

"Rohit" wrote:

Quote:

Originally Posted by

I have a hyperlink on my Web form (home.aspx). I want to open another
form (Login.aspx) when user clicks this link. How to do this? I also
want to maintain site map when another form gets opened.
>
>

Saturday, March 24, 2012

Newbie: Save and display multi-value listbox... (VB.NET)

I have a list box (i.e. FieldA) that allows the user to select more than one option. When saved, this field content is inserted in a table.

My questions are:
- How do i loop through this listbox and save the data. Do i need to concatenate the selected options into a string before or during saving?
- When this saved record is retrieved from the table, do i need to do anything in order to display the options that have previously been selected and saved?
I appreciate any coding that you can provide to assist me...

Try this article, it was helpful to me when I dealt with this same issue.
http://www.developerfusion.co.uk/show/4653/

Newbie: Selecting image from separate aspx page

I have a form where the user can select an image filename. Clearly it
would be better to allow them to select the image itself rather than key
in the filename.

So, I have a server side directory with the available images. And I have
a page which shows the images as ImageButtons.

My question is: What's the best way to link the two?

Should MyForm.aspx redirect to ImageList.aspx passing "MyForm" in the
query string so that ImageList knows where to redirect back to? It works
but it seems a bit convoluted so I think it must be wrong.

How do you solve this when basically you want to pick from a list of
things which aren't on the calling page?

Hope this makes sense.

In the desktop app environment I'd just open a dialog box. what is the
asp.net paradigm?You could simulate a dialog box by using window.open("ImageBox.aspx")
and then add some javascript in the onclick of the Select Button in
the ImageBox codebehind, which
- sets the image in the calling page (window.opener.getElementByID...)
- closes the imagebox window

So - mainly you have to deal with some javascript and DHTML

As to your original question: For easy pageflows I just put the
refering
page in the session/context items/request, which is not elegant, but
simple.
Alternatively you can implement a pageflow manager which can take
care of more complex navigations. Also worth looking at is
Server.Execute instead of redirect or transfer (and having a refering
page property defined in a page base class). There are really
a lot of options here and it is up to your preferences and requirements
to decide which one you want to go with.

-Stefan

Newbie: Selecting image from separate aspx page

I have a form where the user can select an image filename. Clearly it
would be better to allow them to select the image itself rather than key
in the filename.
So, I have a server side directory with the available images. And I have
a page which shows the images as ImageButtons.
My question is: What's the best way to link the two?
Should MyForm.aspx redirect to ImageList.aspx passing "MyForm" in the
query string so that ImageList knows where to redirect back to? It works
but it seems a bit convoluted so I think it must be wrong.
How do you solve this when basically you want to pick from a list of
things which aren't on the calling page?
Hope this makes sense.
In the desktop app environment I'd just open a dialog box. what is the
asp.net paradigm?You could simulate a dialog box by using window.open("ImageBox.aspx")
and then add some javascript in the onclick of the Select Button in
the ImageBox codebehind, which
- sets the image in the calling page (window.opener.getElementByID...)
- closes the imagebox window
So - mainly you have to deal with some javascript and DHTML
As to your original question: For easy pageflows I just put the
refering
page in the session/context items/request, which is not elegant, but
simple.
Alternatively you can implement a pageflow manager which can take
care of more complex navigations. Also worth looking at is
Server.Execute instead of redirect or transfer (and having a refering
page property defined in a page base class). There are really
a lot of options here and it is up to your preferences and requirements
to decide which one you want to go with.
-Stefan
Thanks Stefan.
I guess the session is a better place rather than clogging up the
querystring. I think I need a bit of practise to get into Web way of
doing things.
Colin
Stefan wrote:
> You could simulate a dialog box by using window.open("ImageBox.aspx")
> and then add some javascript in the onclick of the Select Button in
> the ImageBox codebehind, which
> - sets the image in the calling page (window.opener.getElementByID...)
> - closes the imagebox window
> So - mainly you have to deal with some javascript and DHTML
> As to your original question: For easy pageflows I just put the
> refering
> page in the session/context items/request, which is not elegant, but
> simple.
> Alternatively you can implement a pageflow manager which can take
> care of more complex navigations. Also worth looking at is
> Server.Execute instead of redirect or transfer (and having a refering
> page property defined in a page base class). There are really
> a lot of options here and it is up to your preferences and requirements
> to decide which one you want to go with.
> -Stefan
>

Newbie: using asp.net 2.0 profile in an ASP.NET web service

Hi,
Is it possible to use asp.net 2.0 profile in an ASP.NET web service ? I
want to authenticate a user via the web service and store user profile data
using ASP.NET 2.0 profile ? Is it possible at all ?
Thanks in advance and regards
NavinYes, it is possible. You hook the app up to the profile provider and then
add info from the service using the membership and/or profile bits. The main
difference is you generally do not want to hold session in web services like
you might in a web application.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
****************************************
*********
Think outside of the box!
****************************************
*********
"Navin Mishra" <navin.mishra@.siemens.com> wrote in message
news:Ojk2tqr5GHA.2208@.TK2MSFTNGP04.phx.gbl...
> Hi,
> Is it possible to use asp.net 2.0 profile in an ASP.NET web service ? I
> want to authenticate a user via the web service and store user profile
> data using ASP.NET 2.0 profile ? Is it possible at all ?
> Thanks in advance and regards
> Navin
>
Some sample code would help. In a web service, the profile keys added don't
appear as properties of Profile object but in an ASP.NET web app they do.
Thanks in advance and regards
Navin
"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
message news:%23yx0S9u5GHA.2044@.TK2MSFTNGP02.phx.gbl...
> Yes, it is possible. You hook the app up to the profile provider and then
> add info from the service using the membership and/or profile bits. The
> main difference is you generally do not want to hold session in web
> services like you might in a web application.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com
> ****************************************
*********
> Think outside of the box!
> ****************************************
*********
> "Navin Mishra" <navin.mishra@.siemens.com> wrote in message
> news:Ojk2tqr5GHA.2208@.TK2MSFTNGP04.phx.gbl...
>
Any sample code would really help...thanks in advance!
Navin
"Navin Mishra" <navin.mishra@.siemens.com> wrote in message
news:OGtvjBv5GHA.2044@.TK2MSFTNGP02.phx.gbl...
> Some sample code would help. In a web service, the profile keys added
> don't appear as properties of Profile object but in an ASP.NET web app
> they do.
> Thanks in advance and regards
> Navin
> "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
> message news:%23yx0S9u5GHA.2044@.TK2MSFTNGP02.phx.gbl...
>
I am having a problem with this as well
What I am trying to do is to have a textbox that a user begins to type what
he is searching for.
I am using an AutoCompleteExtender to call a method in the web service that
queries the database for the field description and pull "like" results.
The problem is that I already have a profile that handles the users profile,
but I need to add another profile for the property dragOverlayPosition.
Here is my web.config: (sorry its long)
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<!--
The configSections define a section for ASP.NET Atlas.
-->
<configSections>
<sectionGroup name="microsoft.web"
type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
<section name="converters"
type="Microsoft.Web.Configuration.ConvertersSection"
requirePermission="false"/>
<section name="webServices"
type="Microsoft.Web.Configuration.WebServicesSection"
requirePermission="false"/>
<section name="authenticationService"
type="Microsoft.Web.Configuration.AuthenticationServiceSection"
requirePermission="false"/>
<section name="profileService"
type="Microsoft.Web.Configuration.ProfileServiceSection"
requirePermission="false"/>
</sectionGroup>
</configSections>
<!--
The microsoft.web section defines items required for the Atlas
framework.
-->
<microsoft.web>
<converters>
<add
type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
<add
type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
<add
type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
</converters>
<webServices enableBrowserAccess="true"/>
<authenticationService enabled="true"/>
<!-- The example application needs the profileService to be enabled and to
specify the dragOverlayPosition property. -->
<profileService enabled="true" setProperties="dragOverlayPosition"
getProperties="dragOverlayPosition"/>
</microsoft.web>
<appSettings>
<add key="Online" value="1"/>
<add key="ReBidLimit" value="20"/>
</appSettings>
<connectionStrings
configProtectionProvider="DataProtectionConfigurationProvider">
<EncryptedData>
<CipherData>
<CipherValue>AQAAANCMnd8BFdERjHoAwE/ Cl+sBAAAAm9HBmMaT0ka0sma3lHvjeQQAAAACAAA
AAAADZgAAqAAAABAAAADICZdWipnIOoLmIKm/TFfGAAAAAASAAACgAAAAEAAAAIWa0+YCYQK2yoM
XgXduY6v4AQAABee1Y7Uz9xTwwYaZwZGk0FE+EfK
5w6O6ZjbZmAqDdOgXMk6st1S7ZRHmKRcKXIX
Iht6p7nMWkbnm1S7duVu4/sAEfG
Dy0S5OgRqr8v2cwZ8VnSe1Yxuoadw58e9+Nid1TW
Fu0amasyFKXUMJt5WhOs36a6N5mKXndYwWv8
JKewH4uhRR52aItD64/ iNYNC3fXnA0tbIA08PtPBazyFeXNlgMlQ68llwdd
mE9cizXlIYzkYkyEx
vjRhbRiYXMKenkzkFXVZH0+rXyB1JMYKXKGO9516
emzk72hz88Cl2TE064i4TnkKSu9WXSiUL705
YBdbkfW53wpuaREdobq5105np40
iWP6qWdzrULx7I46VWpUcdePfEHc/ i3GgfuAW2zNIwyKA1yGRdkrWa22iL+ymdqOP+Exb
Q0vctbH
TE4AlgmaFVNqdDRCGakMX0jB/nw3S3Q9WWlV1RAWX7Uobm0SNjb7k1E8x5DRgQG/74WGcucGRVXv
GU//D+7fu776CW0crdoFC5q3tmLo7EoOFKQNkDkfqk/C7Wklh/2oBVzvTQR9Jhp0M5XUDMXmtGkw
AhsDOj/RgkqEKj5bTHb5CRrY91d
QQSYEFgJgbvuOyWYT+N2qsPldQxWOjK0GGyb8jk/mxq6i9tKBp2jKWtVaLIayfejIxY76Au6FAAA
ABq6ejD10wN+VUxBxgESIh2z4oQ+</CipherValue>
</CipherData>
</EncryptedData>
</connectionStrings>
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler,
Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx"
type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
<add verb="*" path="*.asbx"
type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
<add name="BridgeModule" type="Microsoft.Web.Services.BridgeModule"/>
<add name="WebResourceCompression"
type="Microsoft.Web.Services.WebResourceCompressionModule"/>
</httpModules>
<customErrors mode="RemoteOnly" defaultRedirect="~/Controls/Error.aspx"/>
<roleManager enabled="true" cacheRolesInCookie="true"
cookieName="gsauctionrole" defaultProvider="GSARoleProvider">
<providers>
<add connectionStringName="gsauctionsConnectionString"
applicationName="/" name="GSARoleProvider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</roleManager>
<siteMap defaultProvider="GSASiteMapProvider" enabled="true">
<providers>
<add name="GSASiteMapProvider" type="System.Web.XmlSiteMapProvider"
securityTrimmingEnabled="true" siteMapFile="Web.sitemap"/>
</providers>
</siteMap>
<anonymousIdentification cookieless="AutoDetect" enabled="true"/>
<profile defaultProvider="GSA_ProfileProvider" enabled="True">
<providers>
<add name="GSA_ProfileProvider"
type="Microsoft.Samples.SqlTableProfileProvider"
connectionStringName="gsauctionsConnectionString" table="gsa_Profiles"
applicationName="/"/>
</providers>
<!-- Old Way
<providers>
<add name="GSA_ProfileProvider"
connectionStringName="gsauctionsConnectionString"
applicationName="/"
type="System.Web.Profile.SqlProfileProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
-->
<properties>
<add name="Email" type="String" defaultValue="[null]"
customProviderData="Email;nvarchar"/>
<add name="UserName" type="String" defaultValue="[null]"
customProviderData="UserName;nvarchar"/>
<add name="FirstName" type="String" defaultValue="[null]"
customProviderData="FirstName;nvarchar"/>
<add name="LastName" type="String" defaultValue="[null]"
customProviderData="LastName;nvarchar"/>
<add name="Organ" type="String" defaultValue="[null]"
customProviderData="Organ;nvarchar"/>
<add name="Dept" type="String" defaultValue="[null]"
customProviderData="Dept;nvarchar"/>
<add name="JobTitle" type="String" defaultValue="[null]"
customProviderData="JobTitle;nvarchar"/>
<add name="TaxEmp" type="String" defaultValue="[null]"
customProviderData="TaxEmp;nvarchar"/>
<add name="NonPro" type="String" defaultValue="[null]"
customProviderData="NonPro;nvarchar"/>
<add name="Street1" type="String" defaultValue="[null]"
customProviderData="Street1;nvarchar"/>
<add name="Street2" type="String" defaultValue="[null]"
customProviderData="Street2;nvarchar"/>
<add name="PostalCode" type="String" defaultValue="[null]"
customProviderData="PostalCode;nvarchar"/>
<add name="City" type="String" defaultValue="[null]"
customProviderData="City;nvarchar"/>
<add name="State" type="String" defaultValue="[null]"
customProviderData="State;nvarchar"/>
<add name="Country" type="String" defaultValue="[null]"
customProviderData="Country;nvarchar"/>
<add name="TPh1" type="String" defaultValue="[null]"
customProviderData="TPh1;nvarchar"/>
<add name="TPh2" type="String" defaultValue="[null]"
customProviderData="TPh2;nvarchar"/>
<add name="CPh1" type="String" defaultValue="[null]"
customProviderData="CPh1;nvarchar"/>
<add name="CPh2" type="String" defaultValue="[null]"
customProviderData="CPh2;nvarchar"/>
<add name="Fax1" type="String" defaultValue="[null]"
customProviderData="Fax1;nvarchar"/>
<add name="Fax2" type="String" defaultValue="[null]"
customProviderData="Fax2;nvarchar"/>
</properties>
</profile>
<!-- Hide those ugly URLs -->
<urlMappings>
<add url="~/Default.aspx?pg=admin" mappedUrl="~/Admin/Default.aspx"/>
<add url="~/Default.aspx?pg=musr" mappedUrl="~/Admin/ManageUsers.aspx"/>
<add url="~/Default.aspx?pg=mcat" mappedUrl="~/Admin/ManageAssets.aspx"/>
<add url="~/Default.aspx?pg=mbid" mappedUrl="~/Admin/ManageAuctions.aspx"/>
<add url="~/Default.aspx?pg=fpwd" mappedUrl="~/Users/Forgotpwd.aspx"/>
<add url="~/Default.aspx?pg=login" mappedUrl="~/Users/Login.aspx"/>
<add url="~/Default.aspx?pg=mpro" mappedUrl="~/Users/MyProfile.aspx"/>
<add url="~/Default.aspx?pg=reset" mappedUrl="~/Users/ResetPwd.aspx"/>
<add url="~/Default.aspx?pg=reg" mappedUrl="~/Users/Register.aspx"/>
</urlMappings>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/></assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider,
Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
<add extension=".asbx" type="Microsoft.Web.Services.BridgeBuildProvider"/>
</buildProviders>
<codeSubDirectories>
<add directoryName="CSCode"/>
<add directoryName="VBCode"/>
</codeSubDirectories>
</compilation>
<pages theme="GSAuction" masterPageFile="~/GSAuction.master">
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
<add namespace="System.Net.Mail"/>
</namespaces>
</pages>
<!--
<authorization>
<allow users="*" />
</authorization>
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="Default.aspx"></forms>
</authentication>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
-->
<membership defaultProvider="GSAMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<add name="GSAMembershipProvider"
connectionStringName="gsauctionsConnectionString" applicationName="/"
requiresUniqueEmail="false" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0
,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</membership>
</system.web>
How or where do I stick this?
<!-- The SimpleList application needs profile to be enabled, and to allow
anonymous users access to the property. -->
<profile enabled="true">
<properties>
<add allowAnonymous="true" name="dragOverlayPosition" defaultValue=""
serializeAs="String"/>
</properties>
</profile>
"Cowboy (Gregory A. Beamer)" wrote:

> Yes, it is possible. You hook the app up to the profile provider and then
> add info from the service using the membership and/or profile bits. The ma
in
> difference is you generally do not want to hold session in web services li
ke
> you might in a web application.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com
> ****************************************
*********
> Think outside of the box!
> ****************************************
*********
> "Navin Mishra" <navin.mishra@.siemens.com> wrote in message
> news:Ojk2tqr5GHA.2208@.TK2MSFTNGP04.phx.gbl...
>
>

newbie: user control question

Hi all!

Currently I have some asp.net pages that nearly implement the same
functionality - so I would like to combine them into one user control. My
question is: is it possible to pass parameters to the user control's
constructor? I would like to specify a parameter that tells the control what
to do internally (e.g. if param=1 then display textbox else display
dropdownbox). The parameter should be stored in ViewState. I could implement
public properties on the control, but I want the parameters to be set only
once.

Thanks

MarkusUser Control Constructors are not instantiated directly. Instead, you use
LoadControl() to load the UserControl. Therefore, I think going with
properties is your best bet.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Markus" <markus_nospam_stehle@.web.de> wrote in message
news:eZUT9au2DHA.3468@.TK2MSFTNGP11.phx.gbl...
> Hi all!
> Currently I have some asp.net pages that nearly implement the same
> functionality - so I would like to combine them into one user control. My
> question is: is it possible to pass parameters to the user control's
> constructor? I would like to specify a parameter that tells the control
what
> to do internally (e.g. if param=1 then display textbox else display
> dropdownbox). The parameter should be stored in ViewState. I could
implement
> public properties on the control, but I want the parameters to be set only
> once.
>
> Thanks
> Markus

newbie: what is postback for?

Just starting to learn asp.net but i dont understand
what postback is for. I have never in asp.old, php or perl
etc. sent the user back to the same page when a submit button
is clicked. Does asp.net insist on this in order to do
automatic validation of inputfields, or is there some other
explaination?? End result is that I always have to do
Response.Redirect() after a submit, which seems clumsy. I am
doing something wrong??Generaly postback is the process of sending form back to the server, but
actually postback is also the client-side script function which initialize
sending web form to the web server. This function is embedded to the
rendered HTML by ASP.NET Framework.
ASP.NET framework allows developer to determ is the page requested for first
time or this form processing is the result of postback

"me" <wtumaxi@.forum.dk> wrote in message
news:6fd6d897.0402160452.727f92f@.posting.google.co m...
> Just starting to learn asp.net but i dont understand
> what postback is for. I have never in asp.old, php or perl
> etc. sent the user back to the same page when a submit button
> is clicked. Does asp.net insist on this in order to do
> automatic validation of inputfields, or is there some other
> explaination?? End result is that I always have to do
> Response.Redirect() after a submit, which seems clumsy. I am
> doing something wrong??
My own opinion, but I think it helps keep code more object-oriented to have
a submit button postback to the same page. That way, you don't have two
separate pages that handle the processing associated with a given form.

For example, a login page:
Old way is to have the username & password textboxes on one page, then the
submit button sends to an authorize page that checks to see if it is legal
username/password and does whatever else. In asp.net, all of that is
handled in a single class / web page. It helps with validation, and from a
developer's point of view, it keeps everything associated with login
isolated to the one class/page. And then, you are correct, you would use a
Response.Redirect() to send the user to either an "Access Denied" page or on
to the rest of the site as an authenticated user. That's just one example.

If you change the name of textboxes, or add other fields & controls, you
(generally) only have to worry about changes within the same class - other
web pages won't be affected.

--
Mike Mayer, C# MVP
mike@.mag37.com
http://www.mag37.com/csharp/

"me" <wtumaxi@.forum.dk> wrote in message
news:6fd6d897.0402160452.727f92f@.posting.google.co m...
> Just starting to learn asp.net but i dont understand
> what postback is for. I have never in asp.old, php or perl
> etc. sent the user back to the same page when a submit button
> is clicked. Does asp.net insist on this in order to do
> automatic validation of inputfields, or is there some other
> explaination?? End result is that I always have to do
> Response.Redirect() after a submit, which seems clumsy. I am
> doing something wrong??

Thursday, March 22, 2012

newboe: how to get the user name?

OS: XP pro
IDE VS 2005 .NET
ASP.NET 2.0
System.Security.AccessControl.SecurityInfos.Owner.ToString() returns
domain\username...if the domain is named "TEST" and username is "per" then
this statement returns TEST\per...
But what code must I do if I went to the fullname of the user?
JeffAsk the user to put it into a form. ;-)
Seriously, though, if the user is logged in to Active Directory, you should
be able to use the System.DirectoryServices namespace and classes to query
the Active Directory for this information.
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
> OS: XP pro
> IDE VS 2005 .NET
> ASP.NET 2.0
> System.Security.AccessControl.SecurityInfos.Owner.ToString() returns
> domain\username...if the domain is named "TEST" and username is "per" then
> this statement returns TEST\per...
> But what code must I do if I went to the fullname of the user?
> Jeff
>
Thanks, I'm looking into it now:
System.DirectoryServices.DirectoryEntry de = new
System.DirectoryServices.DirectoryEntry();
string fullname = de.Properties["displayName"].Value.ToString();
This code isn't working because I need to set the de.Path property before
executing the last line.. I'm not sure how to get the domain name the user
is logged into...Any tips would be great...
I've tryed, with out luck using this statment:
string domain = de.Properties["defaultNamingContext"][0];
This statement gives me an error message saying "This domain do not exist"
(or something like that, the error message I get on my computer is in
Norwegian and I translated it into English... I'm a native Norwegian)
What am I doing wrong here?
Any tips would be received with great appreciation!
Jeff
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uKn1CxZeGHA.5012@.TK2MSFTNGP05.phx.gbl...
> Ask the user to put it into a form. ;-)
> Seriously, though, if the user is logged in to Active Directory, you
> should be able to use the System.DirectoryServices namespace and classes
> to query the Active Directory for this information.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
> Hard work is a medication for which
> there is no placebo.
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
>
Your app will only be able to get AD information about the domain it belongs
to.
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23hChlzaeGHA.3888@.TK2MSFTNGP02.phx.gbl...
> Thanks, I'm looking into it now:
> System.DirectoryServices.DirectoryEntry de = new
> System.DirectoryServices.DirectoryEntry();
> string fullname = de.Properties["displayName"].Value.ToString();
> This code isn't working because I need to set the de.Path property before
> executing the last line.. I'm not sure how to get the domain name the user
> is logged into...Any tips would be great...
> I've tryed, with out luck using this statment:
> string domain = de.Properties["defaultNamingContext"][0];
> This statement gives me an error message saying "This domain do not exist"
> (or something like that, the error message I get on my computer is in
> Norwegian and I translated it into English... I'm a native Norwegian)
> What am I doing wrong here?
> Any tips would be received with great appreciation!
> Jeff
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uKn1CxZeGHA.5012@.TK2MSFTNGP05.phx.gbl...
>

newboe: how to get the user name?

OS: XP pro
IDE VS 2005 .NET
ASP.NET 2.0

System.Security.AccessControl.SecurityInfos.Owner. ToString() returns
domain\username...if the domain is named "TEST" and username is "per" then
this statement returns TEST\per...

But what code must I do if I went to the fullname of the user?

JeffAsk the user to put it into a form. ;-)

Seriously, though, if the user is logged in to Active Directory, you should
be able to use the System.DirectoryServices namespace and classes to query
the Active Directory for this information.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
> OS: XP pro
> IDE VS 2005 .NET
> ASP.NET 2.0
> System.Security.AccessControl.SecurityInfos.Owner. ToString() returns
> domain\username...if the domain is named "TEST" and username is "per" then
> this statement returns TEST\per...
> But what code must I do if I went to the fullname of the user?
> Jeff
Thanks, I'm looking into it now:

System.DirectoryServices.DirectoryEntry de = new
System.DirectoryServices.DirectoryEntry();
string fullname = de.Properties["displayName"].Value.ToString();

This code isn't working because I need to set the de.Path property before
executing the last line.. I'm not sure how to get the domain name the user
is logged into...Any tips would be great...

I've tryed, with out luck using this statment:
string domain = de.Properties["defaultNamingContext"][0];
This statement gives me an error message saying "This domain do not exist"
(or something like that, the error message I get on my computer is in
Norwegian and I translated it into English... I'm a native Norwegian)

What am I doing wrong here?

Any tips would be received with great appreciation!

Jeff

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uKn1CxZeGHA.5012@.TK2MSFTNGP05.phx.gbl...
> Ask the user to put it into a form. ;-)
> Seriously, though, if the user is logged in to Active Directory, you
> should be able to use the System.DirectoryServices namespace and classes
> to query the Active Directory for this information.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
> Hard work is a medication for which
> there is no placebo.
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
>> OS: XP pro
>> IDE VS 2005 .NET
>> ASP.NET 2.0
>>
>> System.Security.AccessControl.SecurityInfos.Owner. ToString() returns
>> domain\username...if the domain is named "TEST" and username is "per"
>> then this statement returns TEST\per...
>>
>> But what code must I do if I went to the fullname of the user?
>>
>> Jeff
>>
Your app will only be able to get AD information about the domain it belongs
to.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23hChlzaeGHA.3888@.TK2MSFTNGP02.phx.gbl...
> Thanks, I'm looking into it now:
> System.DirectoryServices.DirectoryEntry de = new
> System.DirectoryServices.DirectoryEntry();
> string fullname = de.Properties["displayName"].Value.ToString();
> This code isn't working because I need to set the de.Path property before
> executing the last line.. I'm not sure how to get the domain name the user
> is logged into...Any tips would be great...
> I've tryed, with out luck using this statment:
> string domain = de.Properties["defaultNamingContext"][0];
> This statement gives me an error message saying "This domain do not exist"
> (or something like that, the error message I get on my computer is in
> Norwegian and I translated it into English... I'm a native Norwegian)
> What am I doing wrong here?
> Any tips would be received with great appreciation!
> Jeff
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uKn1CxZeGHA.5012@.TK2MSFTNGP05.phx.gbl...
>> Ask the user to put it into a form. ;-)
>>
>> Seriously, though, if the user is logged in to Active Directory, you
>> should be able to use the System.DirectoryServices namespace and classes
>> to query the Active Directory for this information.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> Professional Numbskull
>>
>> Hard work is a medication for which
>> there is no placebo.
>>
>> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
>> news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
>>> OS: XP pro
>>> IDE VS 2005 .NET
>>> ASP.NET 2.0
>>>
>>> System.Security.AccessControl.SecurityInfos.Owner. ToString() returns
>>> domain\username...if the domain is named "TEST" and username is "per"
>>> then this statement returns TEST\per...
>>>
>>> But what code must I do if I went to the fullname of the user?
>>>
>>> Jeff
>>>
>>
>>

Newby level question: Radio Buttons

Hello,

I have a web page that gets the user to select items from a list of options. This list is a set of independant Radio Buttons. I did not use a Radio Button List because I wanted the possibility of multiple selections. However, one item is "None of the above" and I have placed some logic (autopostback, etc.) that will remove all previous selections if "None of the above" is chosen. My problem is this:

This list of Radio Buttons is at the bottom of the web page and with AutoPostback enabled (and someone selects one of these Radio Buttons) the web browser refreshes the screen and shows the top of the page. What can I do such that the screen refreshes and displays the bottom portion with the Radio Buttons? Or is there a way to do what I want to do without using AutoPostback?

TIA...Ferret Face,

You could try out setting the page's Smart Navigation property to true. Smart navigation keeps the screen position during post backs. But it doesn't work for any browser (that I know of) except IE and it can cause flaky behaviour.

Because of this I created a javascript that will automatically scroll a page to whatever control you specify as a reusable object. Actually the javascript object contains many useful scripts.

You can download the Javascript component I built for free with full source code as a VS2003 project from my website, www.aboutfortunate.com. Also download the .chm help file. It gives help for every control I've created all of which are downloadable from my site for free with full source.

To get the javascript component click the "Code Library" link at the top of my page and then click the "Javacript" button on the left.

You'll want to use the "ScrollToElement" method of the component.

If you have any questions about the component or use thereof feel free to email me.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Ferret Face" <ferretface@.msn.com> wrote in message news:LvidnWJEMaeBDr3eRVn-tw@.giganews.com...
Hello,

I have a web page that gets the user to select items from a list of options. This list is a set of independant Radio Buttons. I did not use a Radio Button List because I wanted the possibility of multiple selections. However, one item is "None of the above" and I have placed some logic (autopostback, etc.) that will remove all previous selections if "None of the above" is chosen. My problem is this:

This list of Radio Buttons is at the bottom of the web page and with AutoPostback enabled (and someone selects one of these Radio Buttons) the web browser refreshes the screen and shows the top of the page. What can I do such that the screen refreshes and displays the bottom portion with the Radio Buttons? Or is there a way to do what I want to do without using AutoPostback?

TIA...
One solution is to enable SmartNavigation, although there are a lot of
reasons not to do so
(http://weblogs.asp.net/ksamaschke/a...04/27/6085.aspx,
http://weblogs.asp.net/dreilly/arch.../14/229424.aspx

Alternatively, you might want to take a look at the free (but no source
code) Smart Scroller:
http://www.strengthtechnologies.com/scroll/

Finally, you can likely achieve all that you want in JavaScript if that's
acceptable. Here's a quick example, might not work but should give you an
idea...

<div id="choices">
<input type="Radio" name="1" value="choice1">
<input type="Radio" name="2" value="choice2">
<input type="Radio" name="3" value="choice3">
<input type="Radio" name="4" value="choice4">
<input type="Radio" name="5" value="none" onClick="Clicked('choices',
this);">
</div
<script language="JavaScript">
function Clicked(containerName, source)
{
var container = document.getElementById(containerName);
if (!container){
//something went wrong
return;
}
var inputs = container.getElementsByTagName("INPUT");
for (var i = 0; i < inputs.length; ++i)
{
var input = inputs[i];
//if we have a radiobutton (we don't want to disable a textbox in here
too, or do we?) AND we aren't on the "none" button
if (input.type.toUpperCase() == "RADIO" && input.value != "none")
{
input.disabled = source.checked; //if our non button is checked, the
input is disabled, if it isn't checked, it's enabled.
}
}
}
</script>
--
MY ASP.Net tutorials
http://www.openmymind.net/

"Ferret Face" <ferretface@.msn.com> wrote in message
news:LvidnWJEMaeBDr3eRVn-tw@.giganews.com...
Hello,

I have a web page that gets the user to select items from a list of
options. This list is a set of independant Radio Buttons. I did not use a
Radio Button List because I wanted the possibility of multiple selections.
However, one item is "None of the above" and I have placed some logic
(autopostback, etc.) that will remove all previous selections if "None of
the above" is chosen. My problem is this:

This list of Radio Buttons is at the bottom of the web page and with
AutoPostback enabled (and someone selects one of these Radio Buttons) the
web browser refreshes the screen and shows the top of the page. What can I
do such that the screen refreshes and displays the bottom portion with the
Radio Buttons? Or is there a way to do what I want to do without using
AutoPostback?

TIA...
Hey! Who you callin' Ferret Face?!
... Wait, that's my name.

That JavaScript did the trick. I had to brush-up on JavaScript a bit to
do it. I ended up changing the line

if (input.type.toUpperCase() == "RADIO" && input.value != source.value)

to make it work.

Thanks!

"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%23bJ5xBLtFHA.4080@.TK2MSFTNGP12.phx.gbl...
> One solution is to enable SmartNavigation, although there are a lot of
> reasons not to do so
> (http://weblogs.asp.net/ksamaschke/a...04/27/6085.aspx,
> http://weblogs.asp.net/dreilly/arch.../14/229424.aspx
> Alternatively, you might want to take a look at the free (but no source
> code) Smart Scroller:
> http://www.strengthtechnologies.com/scroll/
> Finally, you can likely achieve all that you want in JavaScript if that's
> acceptable. Here's a quick example, might not work but should give you an
> idea...
> <div id="choices">
> <input type="Radio" name="1" value="choice1">
> <input type="Radio" name="2" value="choice2">
> <input type="Radio" name="3" value="choice3">
> <input type="Radio" name="4" value="choice4">
> <input type="Radio" name="5" value="none" onClick="Clicked('choices',
> this);">
> </div>
> <script language="JavaScript">
> function Clicked(containerName, source)
> {
> var container = document.getElementById(containerName);
> if (!container){
> //something went wrong
> return;
> }
> var inputs = container.getElementsByTagName("INPUT");
> for (var i = 0; i < inputs.length; ++i)
> {
> var input = inputs[i];
> //if we have a radiobutton (we don't want to disable a textbox in here
> too, or do we?) AND we aren't on the "none" button
> if (input.type.toUpperCase() == "RADIO" && input.value != "none")
> {
> input.disabled = source.checked; //if our non button is checked, the
> input is disabled, if it isn't checked, it's enabled.
> }
> }
> }
> </script>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
> "Ferret Face" <ferretface@.msn.com> wrote in message
> news:LvidnWJEMaeBDr3eRVn-tw@.giganews.com...
> Hello,
> I have a web page that gets the user to select items from a list of
> options. This list is a set of independant Radio Buttons. I did not use
a
> Radio Button List because I wanted the possibility of multiple selections.
> However, one item is "None of the above" and I have placed some logic
> (autopostback, etc.) that will remove all previous selections if "None of
> the above" is chosen. My problem is this:
> This list of Radio Buttons is at the bottom of the web page and with
> AutoPostback enabled (and someone selects one of these Radio Buttons) the
> web browser refreshes the screen and shows the top of the page. What can
I
> do such that the screen refreshes and displays the bottom portion with the
> Radio Buttons? Or is there a way to do what I want to do without using
> AutoPostback?
> TIA...

Newby level question: Radio Buttons

Hello,
I have a web page that gets the user to select items from a list of options.
This list is a set of independant Radio Buttons. I did not use a Radio Bu
tton List because I wanted the possibility of multiple selections. However,
one item is "None of the above" and I have placed some logic (autopostback,
etc.) that will remove all previous selections if "None of the above" is ch
osen. My problem is this:
This list of Radio Buttons is at the bottom of the web page and with AutoPos
tback enabled (and someone selects one of these Radio Buttons) the web brows
er refreshes the screen and shows the top of the page. What can I do such t
hat the screen refreshes and displays the bottom portion with the Radio Butt
ons? Or is there a way to do what I want to do without using AutoPostback?
TIA...Ferret Face,
You could try out setting the page's Smart Navigation property to true. Smar
t navigation keeps the screen position during post backs. But it doesn't wor
k for any browser (that I know of) except IE and it can cause flaky behaviou
r.
Because of this I created a javascript that will automatically scroll a page
to whatever control you specify as a reusable object. Actually the javascri
pt object contains many useful scripts.
You can download the Javascript component I built for free with full source code as a V
S2003 project from my website, www.aboutfortunate.com. Also download the .ch
m help file. It gives help for every control I've created all of which are d
ownloadable from my site for free with full source.
To get the javascript component click the "Code Library" link at the top of
my page and then click the "Javacript" button on the left.
You'll want to use the "ScrollToElement" method of the component.
If you have any questions about the component or use thereof feel free to em
ail me.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Ferret Face" <ferretface@.msn.com> wrote in message news:LvidnWJEMaeBDr3eRVn
-tw@.giganews.com...
Hello,
I have a web page that gets the user to select items from a list of options.
This list is a set of independant Radio Buttons. I did not use a Radio Bu
tton List because I wanted the possibility of multiple selections. However,
one item is "None of the above" and I have placed some logic (autopostback,
etc.) that will remove all previous selections if "None of the above" is ch
osen. My problem is this:
This list of Radio Buttons is at the bottom of the web page and with AutoPos
tback enabled (and someone selects one of these Radio Buttons) the web brows
er refreshes the screen and shows the top of the page. What can I do such t
hat the screen refreshes and displays the bottom portion with the Radio Butt
ons? Or is there a way to do what I want to do without using AutoPostback?
TIA...
One solution is to enable SmartNavigation, although there are a lot of
reasons not to do so
(http://weblogs.asp.net/ksamaschke/a...4/27/6085.aspx,
http://weblogs.asp.net/dreilly/arch.../14/229424.aspx
Alternatively, you might want to take a look at the free (but no source
code) Smart Scroller:
http://www.strengthtechnologies.com/scroll/
Finally, you can likely achieve all that you want in JavaScript if that's
acceptable. Here's a quick example, might not work but should give you an
idea...
<div id="choices">
<input type="Radio" name="1" value="choice1">
<input type="Radio" name="2" value="choice2">
<input type="Radio" name="3" value="choice3">
<input type="Radio" name="4" value="choice4">
<input type="Radio" name="5" value="none" onClick="Clicked('choices',
this);">
</div>
<script language="JavaScript">
function Clicked(containerName, source)
{
var container = document.getElementById(containerName);
if (!container){
//something went wrong
return;
}
var inputs = container.getElementsByTagName("INPUT");
for (var i = 0; i < inputs.length; ++i)
{
var input = inputs[i];
//if we have a radiobutton (we don't want to disable a textbox in here
too, or do we?) AND we aren't on the "none" button
if (input.type.toUpperCase() == "RADIO" && input.value != "none")
{
input.disabled = source.checked; //if our non button is checked, the
input is disabled, if it isn't checked, it's enabled.
}
}
}
</script>
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Ferret Face" <ferretface@.msn.com> wrote in message
news:LvidnWJEMaeBDr3eRVn-tw@.giganews.com...
Hello,
I have a web page that gets the user to select items from a list of
options. This list is a set of independant Radio Buttons. I did not use a
Radio Button List because I wanted the possibility of multiple selections.
However, one item is "None of the above" and I have placed some logic
(autopostback, etc.) that will remove all previous selections if "None of
the above" is chosen. My problem is this:
This list of Radio Buttons is at the bottom of the web page and with
AutoPostback enabled (and someone selects one of these Radio Buttons) the
web browser refreshes the screen and shows the top of the page. What can I
do such that the screen refreshes and displays the bottom portion with the
Radio Buttons? Or is there a way to do what I want to do without using
AutoPostback?
TIA...
Hey! Who you callin' Ferret Face?!
... Wait, that's my name.
That JavaScript did the trick. I had to brush-up on JavaScript a bit to
do it. I ended up changing the line
if (input.type.toUpperCase() == "RADIO" && input.value != source.value)
to make it work.
Thanks!
"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%23bJ5xBLtFHA.4080@.TK2MSFTNGP12.phx.gbl...
> One solution is to enable SmartNavigation, although there are a lot of
> reasons not to do so
> (http://weblogs.asp.net/ksamaschke/a...4/27/6085.aspx,
> http://weblogs.asp.net/dreilly/arch.../14/229424.aspx
> Alternatively, you might want to take a look at the free (but no source
> code) Smart Scroller:
> http://www.strengthtechnologies.com/scroll/
> Finally, you can likely achieve all that you want in JavaScript if that's
> acceptable. Here's a quick example, might not work but should give you an
> idea...
> <div id="choices">
> <input type="Radio" name="1" value="choice1">
> <input type="Radio" name="2" value="choice2">
> <input type="Radio" name="3" value="choice3">
> <input type="Radio" name="4" value="choice4">
> <input type="Radio" name="5" value="none" onClick="Clicked('choices',
> this);">
> </div>
> <script language="JavaScript">
> function Clicked(containerName, source)
> {
> var container = document.getElementById(containerName);
> if (!container){
> //something went wrong
> return;
> }
> var inputs = container.getElementsByTagName("INPUT");
> for (var i = 0; i < inputs.length; ++i)
> {
> var input = inputs[i];
> //if we have a radiobutton (we don't want to disable a textbox in here
> too, or do we?) AND we aren't on the "none" button
> if (input.type.toUpperCase() == "RADIO" && input.value != "none")
> {
> input.disabled = source.checked; //if our non button is checked, the
> input is disabled, if it isn't checked, it's enabled.
> }
> }
> }
> </script>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
> "Ferret Face" <ferretface@.msn.com> wrote in message
> news:LvidnWJEMaeBDr3eRVn-tw@.giganews.com...
> Hello,
> I have a web page that gets the user to select items from a list of
> options. This list is a set of independant Radio Buttons. I did not use
a
> Radio Button List because I wanted the possibility of multiple selections.
> However, one item is "None of the above" and I have placed some logic
> (autopostback, etc.) that will remove all previous selections if "None of
> the above" is chosen. My problem is this:
> This list of Radio Buttons is at the bottom of the web page and with
> AutoPostback enabled (and someone selects one of these Radio Buttons) the
> web browser refreshes the screen and shows the top of the page. What can
I
> do such that the screen refreshes and displays the bottom portion with the
> Radio Buttons? Or is there a way to do what I want to do without using
> AutoPostback?
> TIA...
>

Newby Question Linking of data between HTML and ASP!

Hi:

I am an utter virgin at ASP, but have experience in HTML!

I have a very basic question.

I have an ASP sheet, where I wish to permit the user to enter a code, and then return the
results of a query against a table, using that code. My problem is that I don't quite know
how to:

A Present the end user input to the query
B. Present the results to the HTML: code.

In the query I have tried common sql techniques such as "Like{Input the code]", but that
does not work.

I know there must be an easy way, but it too simple to show up in the materials I am
reading.

Can someone point me in the direction of an answer.

Thanks

John Baker> Can someone point me in the direction of an answer.

You can find an answer on the ASP ewsgroups:

microsoft.public.inetserver.asp.db
microsoft.public.inetserver.asp.general

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"John Baker" <Baker.JH@.Verizon.net> wrote in message
news:cccf01dcm7rb7khonngaqa95qv2o8n15sh@.4ax.com...
> Hi:
> I am an utter virgin at ASP, but have experience in HTML!
> I have a very basic question.
> I have an ASP sheet, where I wish to permit the user to enter a code, and
> then return the
> results of a query against a table, using that code. My problem is that I
> don't quite know
> how to:
> A Present the end user input to the query
> B. Present the results to the HTML: code.
> In the query I have tried common sql techniques such as "Like{Input the
> code]", but that
> does not work.
> I know there must be an easy way, but it too simple to show up in the
> materials I am
> reading.
> Can someone point me in the direction of an answer.
> Thanks
> John Baker
Kevin:

Unfortunately Verizon does not offer them.

Any other alternatives?

John
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote:

>microsoft.public.inetserver.asp.general
This is a newsgroup. If you have Outlook Express, you have a news reader.
Using Outlook Experss's newsreader, go to the msnews.microsoft.com news
server and you'll find all of the Microsoft newsgroups.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"John Baker" <Baker.JH@.Verizon.net> wrote in message
news:r2rf015ek9aq5rc9kj82ra9vgll0t6fe4u@.4ax.com...
> Kevin:
> Unfortunately Verizon does not offer them.
> Any other alternatives?
> John
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote:
>>microsoft.public.inetserver.asp.general

Friday, March 16, 2012

newline at Label.Text -- ??

hi,

i have a problem...i have a textBox with multiline enabled, where a user writes a description (some text)

if you press Enter, a new line appears and you may write on multilines, and when i save the description in my database, in place of "newline" i have two squares (i should copy-paste them here but they are interprated as a newline:P - ENTER)

When i load the description from the database into a textbox, the sqares have no effect because there should be a "<br>" or a html command for new line.

what should i do, to save direct in my database the <br> in place of that squares (witch apears when you press enter on a multiline textbox)?

i tryiedLabel1.Text.Replace(" ","<br>"); but i can't paste the squares at first arrgument, because it apears at a new line

i hope you understand...

please help me, thanks

How about:

Label1.Text.Replace(Environment.NewLine,"<br />");


Very good, thank you

Newsletter application

Hey,

I've created a really usefull newsletter application, but it's single user. This means I've created a physical mailbox by hand.
Someone pointed out to me that in order to let user create and send out their own newsletters they need a physical mailbox
aswell. Is this true?

What if I get a 10.000 users, how can I manage so many mailnoxes on a single machine and how to avoid my mailserver getting
marked as a spamserver (blacklisted)?

Should I work with so called smarthosts?

Hope someone has experience with newsletter applications + mailservers.

Cheers!

Hi,

You might have heard of DotNetNuke an open source portal software which comes with full source code.
DNN has a feature that allows administrators of the portals to send out HTML newsletters to a selection of roles or individual users.
The news letters sending has an Asynchronous and Synchronous mode of sending emails.

Download the source code from herehttp://www.dotnetnuke.com/tabid/125/default.aspx and check out the source code you might some good ideas on how to solve your problems.

Goodluck

Newsletter

How to create newsletter in asp.net 2.0?
How to manage email list?
how can user subscribe and unsubscribe?

Hi,
- all kinds of questions about emailing from .NET can be found here:http://www.systemwebmail.com.
- to manage a list of subscribers you could use a webform with a grid on it.
- you can have a page where a person can subscribe. In ASP.NET 2.0 the CreateUserWizard would be a nice control to take a look at for this purpose. After that you can send a confirmation email to make sure that the person who subscribed really owns that emailaddress.
Grz, Kris.


is it possible to create newsletter using any html editor and use that page in your asp.net so that you dont have to write all the html code in asp.net.


Hi,
you could that,read it out using a streamreader and use it to fill up the body of the mail message. Another way could be that you use atext editor like where you type in your questions on this forum and save it into a database. It seems handier to me to do so because you don't have to make up any html and upload it to a server.
Grz, Kris.
That helps. you have any example I can check online.
Hi,
you want an example for...?
If you want to put something into a database you'll be needingADO.NET. The freetextbox I mentioned in my previous post is a free webcontrol that you can download and use. The link to the "reading text from a file" in my previous post shows you how to use the StreamReader class to read from a file.
Grz, Kris.
I tried the below code and it just sends me an blank email. newsletter.htm is a html page with simple newsletter. I also had to put full path for this. I tried "./images/newsletter.htm" and it ended up with error ( cannot find newsletter.htm in c:\windows\system32).
What am I doing wrong here?
Private Const FILE_NAME As String = "C:\Inetpub\wwwroot\Intranet\images\newsletter.htm"
Dim email As MailMessage
If Not File.Exists(FILE_NAME) Then
Console.WriteLine("{0} does not exist.", FILE_NAME)
Return
End If
Dim sr As StreamReader = File.OpenText(FILE_NAME)
Dim input As String
input = sr.ReadLine()
Dim strnews As String
SmtpMail.SmtpServer = "localhost"
email = New MailMessage
email.BodyFormat = MailFormat.Html
email.From =emailme@.email.com
email.To = ("emailme@.email.com")
email.Subject = "News Letter"
While Not input Is Nothing
input = sr.ReadLine()
strnews = input
End While

Hi,
at first glance you missed a property of the MailMessage class:Body. Besides that your code doesn't seem quite clean to me.

While Not input Is Nothing
input = sr.ReadLine()
strnews = input
End While
Why do you assign a string to another string? Also it would be better to write it like this:
strnews += input so you concatenate the strings, now you're just simply replacing them.
Another thing, and even more important, is the fact that you use simple strings to concatenate. This can be done as long as the concatenating doesn't take more than 5 times. Because a string is immutable, every time you concatenate a new string is created. So it's better to use aStringBuilder instance in this case.
So it would be more like this:

Dim sr As StreamReader = File.OpenText(FILE_NAME)
Dim input As New StringBuilder()
SmtpMail.SmtpServer = "localhost"
email = New MailMessage
email.BodyFormat = MailFormat.Html
email.From = emailme@.email.com
email.To = ("emailme@.email.com")
email.Subject = "News Letter"
String strNews
Do strNews = sr.ReadLine()
input.Append(strNews)
Loop Until line Is Nothing
sr.Close()
email.Body = input.ToString()
This code isn't tested and I didn't have any coffee yet.
Grz, Kris.


Hi
Prevent potentially dangerous HTML Tags:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000004.asp
Regards

I want to start with a simple newsletter. First step I want to send out and HTML page. When I try that, it does not display any pictures when viewed in email. Any better way to work on this.
Dim strnewsAsString

SmtpMail.SmtpServer = "w2k3-exch1.360incliv.com"

email =New MailMessage

email.BodyFormat = MailFormat.Html

email.From = "bpatel@.360inc.com"

email.To = ("bpatel@.360inc.com")

email.Subject = "News Letter"

Dim attachmentAsNew MailAttachment(Server.MapPath("newsletter.htm"))'create the attachment

email.Attachments.Add(attachment)'add the attachment

SmtpMail.Send(email)