Showing posts with label 0my. Show all posts
Showing posts with label 0my. Show all posts

Thursday, March 29, 2012

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: menu / sitemap problem

Hey

asp.net 2.0

My webportal consist of 2 menus (a header menu which goes horizontally
across the top of the page. And a sidebar menu to the left. The menuitmes
shown in the sidebar menu is dependent on what menuitem is selected in the
main menu.)

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="">
<siteMapNode url="~/Network.aspx" title="Network" description="" >
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="~/pageA.aspx" title="ItemA" description="" />
<siteMapNode url="~/pageB.aspx" title="ItemB" description="" />
</siteMapNode>
<siteMapNode url="" title="Forum" description="" />
</siteMapNode>
</siteMap>

When the "Network" menuitem in my main menu is clicked the sidebar menu
displays these menu items "Search", "ItemA", "ItemB". So now if the user
clicks on the "Search" menuitem in the sidebar menu, the sidebar menu
continue to display the same menuitems ("Search", "ItemA", "ItemB").

Problem:
In the "Search.aspx" file there is a button (btnSearch), which when clicked
executes this code:
protected void btnSearch_Click(object sender, EventArgs e)
{
Response.Redirect("~/Result.aspx?name=" + txtFullname.Text);
}

So when the result.aspx page is displayed. the sidebar menu is empty. I
think this must be related to using "Response.Redirect" to open the
"result.aspx" page. When the "result.aspx" page is opened. I want the
sidebar menu to continue to display the same menuitems ("Search", "ItemA",
"ItemB") as it did in the "search.aspx" page.

Any suggestions?

JeffI don't think that your problem has anything to do with the redirect.

You could try separating the
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="~/pageA.aspx" title="ItemA" description="" />
<siteMapNode url="~/pageB.aspx" title="ItemB" description="" />

into a separate sitemap file and creating a new SitemapProvider that the
side menu would bind to (you can specify the sitemap file in the sitempa
definintion)

or
(and I haven't tried this myself)
The sitemap schema allows you to specify a provider or sitemap file on a
sitempa node. So what you might be able to do is:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="">
<siteMapNode url="~/Network.aspx" title="Network" description=""
siteMapFile="newFile.sitemap">
</siteMapNode>
<siteMapNode url="~/Result.aspx" title="Result" description=""
siteMapFile="newFile.sitemap">
</siteMapNode>
<siteMapNode url="" title="Forum" description="" />
</siteMapNode>
</siteMap>

Note that when the XMLSitemapProvider tries to find a node it search the
node list by url, including the querystring. This could cause you problems,
you may need to strore the name query string parameter in session.

Hope this helps,

Garth

"Jeff" wrote:

Quote:

Originally Posted by

Hey
>
asp.net 2.0
>
My webportal consist of 2 menus (a header menu which goes horizontally
across the top of the page. And a sidebar menu to the left. The menuitmes
shown in the sidebar menu is dependent on what menuitem is selected in the
main menu.)
>
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="">
<siteMapNode url="~/Network.aspx" title="Network" description="" >
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="~/pageA.aspx" title="ItemA" description="" />
<siteMapNode url="~/pageB.aspx" title="ItemB" description="" />
</siteMapNode>
<siteMapNode url="" title="Forum" description="" />
</siteMapNode>
</siteMap>
>
When the "Network" menuitem in my main menu is clicked the sidebar menu
displays these menu items "Search", "ItemA", "ItemB". So now if the user
clicks on the "Search" menuitem in the sidebar menu, the sidebar menu
continue to display the same menuitems ("Search", "ItemA", "ItemB").
>
Problem:
In the "Search.aspx" file there is a button (btnSearch), which when clicked
executes this code:
protected void btnSearch_Click(object sender, EventArgs e)
{
Response.Redirect("~/Result.aspx?name=" + txtFullname.Text);
}
>
So when the result.aspx page is displayed. the sidebar menu is empty. I
think this must be related to using "Response.Redirect" to open the
"result.aspx" page. When the "result.aspx" page is opened. I want the
sidebar menu to continue to display the same menuitems ("Search", "ItemA",
"ItemB") as it did in the "search.aspx" page.
>
Any suggestions?
>
Jeff
>
>
>


Thanks for replying so soon to my thread!

I don't quite understand (rememeber I'm a newbie) how this could solve my
problem. I mean I don't understand how putting the sidebar menuitems in it's
own sitemap file / provider could fix it... It works today with 1 sitemap
file and 1 provider. The problem is with the result.aspx page which is not
accessible through the menu. (currently not added to the sitemap, but could
add it if that is recommended)

Maybe I should have added that I based the configuration of my menus on
article: http://msdn2.microsoft.com/en-us/library/16yk5dby.aspx which shows
how to combine 2 menus, one menu dependent on the other menu.

When the user clicks on the "Network" menuitem in the main menu, the sidebar
menu displays "Search", "ItemA", "ItemB" menuitems. It continue to display
these menuitems when the user clicks on the "Search" menuitem in the sidebar
menu. It's only when the result.aspx file is displayed that the sidebar menu
shows no menuitems...

Any thoughts?

Jeff

"GarthS" <GarthS@.discussions.microsoft.comwrote in message
news:AF1F5849-1230-4B46-B58F-49547A835A99@.microsoft.com...

Quote:

Originally Posted by

>I don't think that your problem has anything to do with the redirect.
>
You could try separating the
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="~/pageA.aspx" title="ItemA" description="" />
<siteMapNode url="~/pageB.aspx" title="ItemB" description="" />
>
into a separate sitemap file and creating a new SitemapProvider that the
side menu would bind to (you can specify the sitemap file in the sitempa
definintion)
>
or
(and I haven't tried this myself)
The sitemap schema allows you to specify a provider or sitemap file on a
sitempa node. So what you might be able to do is:
>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="">
<siteMapNode url="~/Network.aspx" title="Network" description=""
siteMapFile="newFile.sitemap">
</siteMapNode>
<siteMapNode url="~/Result.aspx" title="Result" description=""
siteMapFile="newFile.sitemap">
</siteMapNode>
<siteMapNode url="" title="Forum" description="" />
</siteMapNode>
</siteMap>
>
Note that when the XMLSitemapProvider tries to find a node it search the
node list by url, including the querystring. This could cause you
problems,
you may need to strore the name query string parameter in session.
>
Hope this helps,
>
Garth
>
"Jeff" wrote:
>

Quote:

Originally Posted by

>Hey
>>
>asp.net 2.0
>>
>My webportal consist of 2 menus (a header menu which goes horizontally
>across the top of the page. And a sidebar menu to the left. The menuitmes
>shown in the sidebar menu is dependent on what menuitem is selected in
>the
>main menu.)
>>
><?xml version="1.0" encoding="utf-8" ?>
><siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
> <siteMapNode url="Default.aspx" title="Home" description="">
> <siteMapNode url="~/Network.aspx" title="Network" description=""

Quote:

Originally Posted by

> >


> <siteMapNode url="~/Search.aspx" title="Search" description=""
>/>
> <siteMapNode url="~/pageA.aspx" title="ItemA" description=""
>/>
> <siteMapNode url="~/pageB.aspx" title="ItemB" description=""
>/>
> </siteMapNode>
> <siteMapNode url="" title="Forum" description="" />
> </siteMapNode>
></siteMap>
>>
>When the "Network" menuitem in my main menu is clicked the sidebar menu
>displays these menu items "Search", "ItemA", "ItemB". So now if the user
>clicks on the "Search" menuitem in the sidebar menu, the sidebar menu
>continue to display the same menuitems ("Search", "ItemA", "ItemB").
>>
>Problem:
>In the "Search.aspx" file there is a button (btnSearch), which when
>clicked
>executes this code:
>protected void btnSearch_Click(object sender, EventArgs e)
>{
> Response.Redirect("~/Result.aspx?name=" + txtFullname.Text);
>}
>>
>So when the result.aspx page is displayed. the sidebar menu is empty. I
>think this must be related to using "Response.Redirect" to open the
>"result.aspx" page. When the "result.aspx" page is opened. I want the
>sidebar menu to continue to display the same menuitems ("Search",
>"ItemA",
>"ItemB") as it did in the "search.aspx" page.
>>
>Any suggestions?
>>
>Jeff
>>
>>
>>


"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:OEdOwrEsGHA.5072@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

Thanks for replying so soon to my thread!
>
I don't quite understand (rememeber I'm a newbie) how this could solve my
problem. I mean I don't understand how putting the sidebar menuitems in
it's own sitemap file / provider could fix it... It works today with 1
sitemap file and 1 provider. The problem is with the result.aspx page
which is not accessible through the menu. (currently not added to the
sitemap, but could add it if that is recommended)
>
Maybe I should have added that I based the configuration of my menus on
article: http://msdn2.microsoft.com/en-us/library/16yk5dby.aspx which
shows how to combine 2 menus, one menu dependent on the other menu.
>
When the user clicks on the "Network" menuitem in the main menu, the
sidebar menu displays "Search", "ItemA", "ItemB" menuitems. It continue to
display these menuitems when the user clicks on the "Search" menuitem in
the sidebar menu. It's only when the result.aspx file is displayed that
the sidebar menu shows no menuitems...
>
Any thoughts?
>
Jeff
>
>
"GarthS" <GarthS@.discussions.microsoft.comwrote in message
news:AF1F5849-1230-4B46-B58F-49547A835A99@.microsoft.com...

Quote:

Originally Posted by

>>I don't think that your problem has anything to do with the redirect.
>>
>You could try separating the
><siteMapNode url="~/Search.aspx" title="Search" description="" />
><siteMapNode url="~/pageA.aspx" title="ItemA" description="" />
><siteMapNode url="~/pageB.aspx" title="ItemB" description="" />
>>
>into a separate sitemap file and creating a new SitemapProvider that the
>side menu would bind to (you can specify the sitemap file in the sitempa
>definintion)
>>
>or
>(and I haven't tried this myself)
>The sitemap schema allows you to specify a provider or sitemap file on a
>sitempa node. So what you might be able to do is:
>>
><siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
> <siteMapNode url="Default.aspx" title="Home" description="">
> <siteMapNode url="~/Network.aspx" title="Network" description=""
>siteMapFile="newFile.sitemap">
> </siteMapNode>
> <siteMapNode url="~/Result.aspx" title="Result" description=""
>siteMapFile="newFile.sitemap">
> </siteMapNode>
> <siteMapNode url="" title="Forum" description="" />
> </siteMapNode>
></siteMap>
>>
>Note that when the XMLSitemapProvider tries to find a node it search the
>node list by url, including the querystring. This could cause you
>problems,
>you may need to strore the name query string parameter in session.
>>
>Hope this helps,
>>
>Garth
>>
>"Jeff" wrote:
>>

Quote:

Originally Posted by

>>Hey
>>>
>>asp.net 2.0
>>>
>>My webportal consist of 2 menus (a header menu which goes horizontally
>>across the top of the page. And a sidebar menu to the left. The
>>menuitmes
>>shown in the sidebar menu is dependent on what menuitem is selected in
>>the
>>main menu.)
>>>
>><?xml version="1.0" encoding="utf-8" ?>
>><siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
>> <siteMapNode url="Default.aspx" title="Home" description="">
>> <siteMapNode url="~/Network.aspx" title="Network"
>>description="" >
>> <siteMapNode url="~/Search.aspx" title="Search"
>>description="" />
>> <siteMapNode url="~/pageA.aspx" title="ItemA" description=""
>>/>
>> <siteMapNode url="~/pageB.aspx" title="ItemB" description=""
>>/>
>> </siteMapNode>
>> <siteMapNode url="" title="Forum" description="" />
>> </siteMapNode>
>></siteMap>
>>>
>>When the "Network" menuitem in my main menu is clicked the sidebar menu
>>displays these menu items "Search", "ItemA", "ItemB". So now if the user
>>clicks on the "Search" menuitem in the sidebar menu, the sidebar menu
>>continue to display the same menuitems ("Search", "ItemA", "ItemB").
>>>
>>Problem:
>>In the "Search.aspx" file there is a button (btnSearch), which when
>>clicked
>>executes this code:
>>protected void btnSearch_Click(object sender, EventArgs e)
>>{
>> Response.Redirect("~/Result.aspx?name=" + txtFullname.Text);
>>}
>>>
>>So when the result.aspx page is displayed. the sidebar menu is empty. I
>>think this must be related to using "Response.Redirect" to open the
>>"result.aspx" page. When the "result.aspx" page is opened. I want the
>>sidebar menu to continue to display the same menuitems ("Search",
>>"ItemA",
>>"ItemB") as it did in the "search.aspx" page.
>>>
>>Any suggestions?
>>>
>>Jeff
>>>
>>>
>>>


>
>


Jeff,
Moving the side menu items into another sitemap wont fix your problem
directly but it will allow you to reuse those items as a submenu to the
results page if you add it as a sitemap node (the Network and Results nodes
point to the same file so if you change the sidew menu items its reflected in
both).

Can you post your settings for each of your SiteMapDataSources? (primarily
ShowStartingNode, StartFromCurrentNode, StartingNodeOffset and
StartingNodeUrl).

I'm thinking that adding the results page ot the sitemap will be problematic
due to the query string component added when you redirect. What you may be
able to do is set the side menu sitemap datasource StartingNodeUrl property
(if your using it as per the walkthrough) in the Page_Load of the
results.aspx.

Garth

"Jeff" wrote:

Quote:

Originally Posted by

Thanks for replying so soon to my thread!
>
I don't quite understand (rememeber I'm a newbie) how this could solve my
problem. I mean I don't understand how putting the sidebar menuitems in it's
own sitemap file / provider could fix it... It works today with 1 sitemap
file and 1 provider. The problem is with the result.aspx page which is not
accessible through the menu. (currently not added to the sitemap, but could
add it if that is recommended)
>
Maybe I should have added that I based the configuration of my menus on
article: http://msdn2.microsoft.com/en-us/library/16yk5dby.aspx which shows
how to combine 2 menus, one menu dependent on the other menu.
>
When the user clicks on the "Network" menuitem in the main menu, the sidebar
menu displays "Search", "ItemA", "ItemB" menuitems. It continue to display
these menuitems when the user clicks on the "Search" menuitem in the sidebar
menu. It's only when the result.aspx file is displayed that the sidebar menu
shows no menuitems...
>
Any thoughts?
>
Jeff
>
>
"GarthS" <GarthS@.discussions.microsoft.comwrote in message
news:AF1F5849-1230-4B46-B58F-49547A835A99@.microsoft.com...

Quote:

Originally Posted by

I don't think that your problem has anything to do with the redirect.

You could try separating the
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="~/pageA.aspx" title="ItemA" description="" />
<siteMapNode url="~/pageB.aspx" title="ItemB" description="" />

into a separate sitemap file and creating a new SitemapProvider that the
side menu would bind to (you can specify the sitemap file in the sitempa
definintion)

or
(and I haven't tried this myself)
The sitemap schema allows you to specify a provider or sitemap file on a
sitempa node. So what you might be able to do is:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="">
<siteMapNode url="~/Network.aspx" title="Network" description=""
siteMapFile="newFile.sitemap">
</siteMapNode>
<siteMapNode url="~/Result.aspx" title="Result" description=""
siteMapFile="newFile.sitemap">
</siteMapNode>
<siteMapNode url="" title="Forum" description="" />
</siteMapNode>
</siteMap>

Note that when the XMLSitemapProvider tries to find a node it search the
node list by url, including the querystring. This could cause you
problems,
you may need to strore the name query string parameter in session.

Hope this helps,

Garth

"Jeff" wrote:

Quote:

Originally Posted by

Hey
>
asp.net 2.0
>
My webportal consist of 2 menus (a header menu which goes horizontally
across the top of the page. And a sidebar menu to the left. The menuitmes
shown in the sidebar menu is dependent on what menuitem is selected in
the
main menu.)
>
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="">
<siteMapNode url="~/Network.aspx" title="Network" description=""
>
<siteMapNode url="~/Search.aspx" title="Search" description=""
/>
<siteMapNode url="~/pageA.aspx" title="ItemA" description=""
/>
<siteMapNode url="~/pageB.aspx" title="ItemB" description=""
/>
</siteMapNode>
<siteMapNode url="" title="Forum" description="" />
</siteMapNode>
</siteMap>
>
When the "Network" menuitem in my main menu is clicked the sidebar menu
displays these menu items "Search", "ItemA", "ItemB". So now if the user
clicks on the "Search" menuitem in the sidebar menu, the sidebar menu
continue to display the same menuitems ("Search", "ItemA", "ItemB").
>
Problem:
In the "Search.aspx" file there is a button (btnSearch), which when
clicked
executes this code:
protected void btnSearch_Click(object sender, EventArgs e)
{
Response.Redirect("~/Result.aspx?name=" + txtFullname.Text);
}
>
So when the result.aspx page is displayed. the sidebar menu is empty. I
think this must be related to using "Response.Redirect" to open the
"result.aspx" page. When the "result.aspx" page is opened. I want the
sidebar menu to continue to display the same menuitems ("Search",
"ItemA",
"ItemB") as it did in the "search.aspx" page.
>
Any suggestions?
>
Jeff
>
>
>


>
>
>

newbie: my code crashe, NULL value

Hey
asp.net 2.0
My code below crashes at the "return (int)cmd.Parameters["@dotnet.itags.org.return"].Value;"
line. In the debugging window I see that when this exception occur, the
"return (int)cmd.Parameters["@dotnet.itags.org.return"].Value;" has a NULL value...
public override int SendMessage(MessageDetails message)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@dotnet.itags.org.receiver", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@dotnet.itags.org.sender", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@dotnet.itags.org.title", SqlDbType.NVarChar).Value =
message.Title;
cmd.Parameters.Add("@dotnet.itags.org.body", SqlDbType.NVarChar).Value =
message.Body;
cmd.Parameters.Add("@dotnet.itags.org.return", SqlDbType.Int).Direction =
ParameterDirection.Output;
cn.Open();
int ret = ExecuteNonQuery(cmd);
return (int)cmd.Parameters["@dotnet.itags.org.return"].Value;
}
}
This is the stored procdure called in the method:
ALTER PROCEDURE dbo.AH_network_SendMessages
@dotnet.itags.org.sender nvarchar(256),
@dotnet.itags.org.receiver nvarchar(256),
@dotnet.itags.org.title nvarchar(100),
@dotnet.itags.org.body nvarchar(2000),
@dotnet.itags.org.return int OUTPUT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO AH_Messages (sender, receiver, title, body)
VALUES (@dotnet.itags.org.sender, @dotnet.itags.org.receiver, @dotnet.itags.org.title, @dotnet.itags.org.body);
set @dotnet.itags.org.return = 1;
select 1;
END
Please, what am I doing wrong here?
JeffIf altering the signature of your SP, you may consider the following option
that should work.
SqlParameter returnValue = sqlCommand.Parameters.Add("@.YourSPReturnValue",
SqlDbType.Int);
returnValue.Direction = ParameterDirection.ReturnValue;
return (Int32)returnValue.Value;
Declaring an explicit return value is in my opinion preferrable, as it is
more clear about your intent and somewhat cleans up the SP declaration.
Tor Bdshaug
tor.badshaug(AT)bekk.no
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...
> Hey
> asp.net 2.0
> My code below crashes at the "return
> (int)cmd.Parameters["@.return"].Value;" line. In the debugging window I see
> that when this exception occur, the "return
> (int)cmd.Parameters["@.return"].Value;" has a NULL value...
> public override int SendMessage(MessageDetails message)
> {
> using (SqlConnection cn = new SqlConnection(this.ConnectionString))
> {
> SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
> cmd.CommandType = CommandType.StoredProcedure;
> cmd.Parameters.Add("@.receiver", SqlDbType.NVarChar).Value =
> message.Sender;
> cmd.Parameters.Add("@.sender", SqlDbType.NVarChar).Value =
> message.Sender;
> cmd.Parameters.Add("@.title", SqlDbType.NVarChar).Value =
> message.Title;
> cmd.Parameters.Add("@.body", SqlDbType.NVarChar).Value =
> message.Body;
> cmd.Parameters.Add("@.return", SqlDbType.Int).Direction =
> ParameterDirection.Output;
> cn.Open();
> int ret = ExecuteNonQuery(cmd);
> return (int)cmd.Parameters["@.return"].Value;
> }
> }
> This is the stored procdure called in the method:
> ALTER PROCEDURE dbo.AH_network_SendMessages
> @.sender nvarchar(256),
> @.receiver nvarchar(256),
> @.title nvarchar(100),
> @.body nvarchar(2000),
> @.return int OUTPUT
> AS
> BEGIN
> SET NOCOUNT ON;
> INSERT INTO AH_Messages (sender, receiver, title, body)
> VALUES (@.sender, @.receiver, @.title, @.body);
> set @.return = 1;
> select 1;
> END
> Please, what am I doing wrong here?
> Jeff
>
What is the ExecuteNonQuery method you try to call after all?
Normally, you will do a cmd.ExecuteNonQuery, rather than
ExecuteNonQuery(cmd).
Could it be that your ExecuteNonQuery(SqlCommand cmd) method in somewhat
fail to do a cmd.ExecuteNonQuery.
The fact that the output parameter does not have a value may suggest that
may be the case.
Tor Bdshaug
tor.badshaug(AT)bekk.no
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...
> Hey
> asp.net 2.0
> My code below crashes at the "return
> (int)cmd.Parameters["@.return"].Value;" line. In the debugging window I see
> that when this exception occur, the "return
> (int)cmd.Parameters["@.return"].Value;" has a NULL value...
> public override int SendMessage(MessageDetails message)
> {
> using (SqlConnection cn = new SqlConnection(this.ConnectionString))
> {
> SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
> cmd.CommandType = CommandType.StoredProcedure;
> cmd.Parameters.Add("@.receiver", SqlDbType.NVarChar).Value =
> message.Sender;
> cmd.Parameters.Add("@.sender", SqlDbType.NVarChar).Value =
> message.Sender;
> cmd.Parameters.Add("@.title", SqlDbType.NVarChar).Value =
> message.Title;
> cmd.Parameters.Add("@.body", SqlDbType.NVarChar).Value =
> message.Body;
> cmd.Parameters.Add("@.return", SqlDbType.Int).Direction =
> ParameterDirection.Output;
> cn.Open();
> int ret = ExecuteNonQuery(cmd);
> return (int)cmd.Parameters["@.return"].Value;
> }
> }
> This is the stored procdure called in the method:
> ALTER PROCEDURE dbo.AH_network_SendMessages
> @.sender nvarchar(256),
> @.receiver nvarchar(256),
> @.title nvarchar(100),
> @.body nvarchar(2000),
> @.return int OUTPUT
> AS
> BEGIN
> SET NOCOUNT ON;
> INSERT INTO AH_Messages (sender, receiver, title, body)
> VALUES (@.sender, @.receiver, @.title, @.body);
> set @.return = 1;
> select 1;
> END
> Please, what am I doing wrong here?
> Jeff
>
I am not sure why you are selecting 1 after setting the @.return. There is no
need unless you are doing something with it. Since you are ExecuteNonQuery,
this is a wasted cycle.
Next, why are you not testing "ret" in your code. If it is -1, the insert
failed for some reason. By testing that you could determine what your issue
is.
Also, why have you not wrapped the open and ExecuteNonQuery() in a try. Here
is a good pattern:
try
{
cn.Open();
int ret = ExecuteNonQuery(cmd);
}
finally
{
cn.Dispose();
}
Not sure what you are returning.
Next suggestion. Do not return until you test the parameter. If it is is
null, the cast to int will blow up (nice technical term ;-> ).
Be careful with calling thisgs return in a stored proc, as SQL Server
already returns a value (even if you do not declare it) called
@.RETURN_VALUE.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/
****************************************
*********
Think Outside the Box!
****************************************
*********
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...
> Hey
> asp.net 2.0
> My code below crashes at the "return
> (int)cmd.Parameters["@.return"].Value;" line. In the debugging window I see
> that when this exception occur, the "return
> (int)cmd.Parameters["@.return"].Value;" has a NULL value...
> public override int SendMessage(MessageDetails message)
> {
> using (SqlConnection cn = new SqlConnection(this.ConnectionString))
> {
> SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
> cmd.CommandType = CommandType.StoredProcedure;
> cmd.Parameters.Add("@.receiver", SqlDbType.NVarChar).Value =
> message.Sender;
> cmd.Parameters.Add("@.sender", SqlDbType.NVarChar).Value =
> message.Sender;
> cmd.Parameters.Add("@.title", SqlDbType.NVarChar).Value =
> message.Title;
> cmd.Parameters.Add("@.body", SqlDbType.NVarChar).Value =
> message.Body;
> cmd.Parameters.Add("@.return", SqlDbType.Int).Direction =
> ParameterDirection.Output;
> cn.Open();
> int ret = ExecuteNonQuery(cmd);
> return (int)cmd.Parameters["@.return"].Value;
> }
> }
> This is the stored procdure called in the method:
> ALTER PROCEDURE dbo.AH_network_SendMessages
> @.sender nvarchar(256),
> @.receiver nvarchar(256),
> @.title nvarchar(100),
> @.body nvarchar(2000),
> @.return int OUTPUT
> AS
> BEGIN
> SET NOCOUNT ON;
> INSERT INTO AH_Messages (sender, receiver, title, body)
> VALUES (@.sender, @.receiver, @.title, @.body);
> set @.return = 1;
> select 1;
> END
> Please, what am I doing wrong here?
> Jeff
>
Thanks, the error was in the ExecuteNonQuery method, which is just a wrapper
around SqlCommand.ExecuteNonQuery... It's solved now, thanks to your tip
about checking ExecuteNonQuery
"Tor Bdshaug" <tor.badshaug@.nospam.com> wrote in message
news:%23TqCCAw6GHA.4996@.TK2MSFTNGP04.phx.gbl...
> What is the ExecuteNonQuery method you try to call after all?
> Normally, you will do a cmd.ExecuteNonQuery, rather than
> ExecuteNonQuery(cmd).
> Could it be that your ExecuteNonQuery(SqlCommand cmd) method in somewhat
> fail to do a cmd.ExecuteNonQuery.
> The fact that the output parameter does not have a value may suggest that
> may be the case.
> Tor Bdshaug
> tor.badshaug(AT)bekk.no
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...
>
Hey
Thanks, yes selecting 1 after setting the @.return to 1 is bad programming. I
know it, I will later rewrite this stored procedure and then I will fix
this.. the procedure is also missing a commit/rollback... I guess auto
commit is enabled but I prefer using explicit transaction...
"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
message news:ON3X9Jw6GHA.2288@.TK2MSFTNGP05.phx.gbl...
>I am not sure why you are selecting 1 after setting the @.return. There is
>no need unless you are doing something with it. Since you are
>ExecuteNonQuery, this is a wasted cycle.
> Next, why are you not testing "ret" in your code. If it is -1, the insert
> failed for some reason. By testing that you could determine what your
> issue is.
> Also, why have you not wrapped the open and ExecuteNonQuery() in a try.
> Here is a good pattern:
> try
> {
> cn.Open();
> int ret = ExecuteNonQuery(cmd);
> }
> finally
> {
> cn.Dispose();
> }
> Not sure what you are returning.
> Next suggestion. Do not return until you test the parameter. If it is is
> null, the cast to int will blow up (nice technical term ;-> ).
> Be careful with calling thisgs return in a stored proc, as SQL Server
> already returns a value (even if you do not declare it) called
> @.RETURN_VALUE.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com/
> ****************************************
*********
> Think Outside the Box!
> ****************************************
*********
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...
>

newbie: my code crashe, NULL value

Hey

asp.net 2.0

My code below crashes at the "return (int)cmd.Parameters["@dotnet.itags.org.return"].Value;"
line. In the debugging window I see that when this exception occur, the
"return (int)cmd.Parameters["@dotnet.itags.org.return"].Value;" has a NULL value...

public override int SendMessage(MessageDetails message)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@dotnet.itags.org.receiver", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@dotnet.itags.org.sender", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@dotnet.itags.org.title", SqlDbType.NVarChar).Value =
message.Title;
cmd.Parameters.Add("@dotnet.itags.org.body", SqlDbType.NVarChar).Value =
message.Body;
cmd.Parameters.Add("@dotnet.itags.org.return", SqlDbType.Int).Direction =
ParameterDirection.Output;
cn.Open();
int ret = ExecuteNonQuery(cmd);
return (int)cmd.Parameters["@dotnet.itags.org.return"].Value;
}
}

This is the stored procdure called in the method:
ALTER PROCEDURE dbo.AH_network_SendMessages
@dotnet.itags.org.sender nvarchar(256),
@dotnet.itags.org.receiver nvarchar(256),
@dotnet.itags.org.title nvarchar(100),
@dotnet.itags.org.body nvarchar(2000),
@dotnet.itags.org.return int OUTPUT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO AH_Messages (sender, receiver, title, body)
VALUES (@dotnet.itags.org.sender, @dotnet.itags.org.receiver, @dotnet.itags.org.title, @dotnet.itags.org.body);

set @dotnet.itags.org.return = 1;
select 1;
END

Please, what am I doing wrong here?

JeffIf altering the signature of your SP, you may consider the following option
that should work.

SqlParameter returnValue = sqlCommand.Parameters.Add("@.YourSPReturnValue",
SqlDbType.Int);
returnValue.Direction = ParameterDirection.ReturnValue;
return (Int32)returnValue.Value;

Declaring an explicit return value is in my opinion preferrable, as it is
more clear about your intent and somewhat cleans up the SP declaration.

Tor Bdshaug
tor.badshaug(AT)bekk.no

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hey
>
asp.net 2.0
>
My code below crashes at the "return
(int)cmd.Parameters["@.return"].Value;" line. In the debugging window I see
that when this exception occur, the "return
(int)cmd.Parameters["@.return"].Value;" has a NULL value...
>
public override int SendMessage(MessageDetails message)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@.receiver", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@.sender", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@.title", SqlDbType.NVarChar).Value =
message.Title;
cmd.Parameters.Add("@.body", SqlDbType.NVarChar).Value =
message.Body;
cmd.Parameters.Add("@.return", SqlDbType.Int).Direction =
ParameterDirection.Output;
cn.Open();
int ret = ExecuteNonQuery(cmd);
return (int)cmd.Parameters["@.return"].Value;
}
}
>
This is the stored procdure called in the method:
ALTER PROCEDURE dbo.AH_network_SendMessages
@.sender nvarchar(256),
@.receiver nvarchar(256),
@.title nvarchar(100),
@.body nvarchar(2000),
@.return int OUTPUT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO AH_Messages (sender, receiver, title, body)
VALUES (@.sender, @.receiver, @.title, @.body);
>
set @.return = 1;
select 1;
END
>
Please, what am I doing wrong here?
>
Jeff
>


What is the ExecuteNonQuery method you try to call after all?
Normally, you will do a cmd.ExecuteNonQuery, rather than
ExecuteNonQuery(cmd).
Could it be that your ExecuteNonQuery(SqlCommand cmd) method in somewhat
fail to do a cmd.ExecuteNonQuery.
The fact that the output parameter does not have a value may suggest that
may be the case.

Tor Bdshaug
tor.badshaug(AT)bekk.no

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hey
>
asp.net 2.0
>
My code below crashes at the "return
(int)cmd.Parameters["@.return"].Value;" line. In the debugging window I see
that when this exception occur, the "return
(int)cmd.Parameters["@.return"].Value;" has a NULL value...
>
public override int SendMessage(MessageDetails message)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@.receiver", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@.sender", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@.title", SqlDbType.NVarChar).Value =
message.Title;
cmd.Parameters.Add("@.body", SqlDbType.NVarChar).Value =
message.Body;
cmd.Parameters.Add("@.return", SqlDbType.Int).Direction =
ParameterDirection.Output;
cn.Open();
int ret = ExecuteNonQuery(cmd);
return (int)cmd.Parameters["@.return"].Value;
}
}
>
This is the stored procdure called in the method:
ALTER PROCEDURE dbo.AH_network_SendMessages
@.sender nvarchar(256),
@.receiver nvarchar(256),
@.title nvarchar(100),
@.body nvarchar(2000),
@.return int OUTPUT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO AH_Messages (sender, receiver, title, body)
VALUES (@.sender, @.receiver, @.title, @.body);
>
set @.return = 1;
select 1;
END
>
Please, what am I doing wrong here?
>
Jeff
>


Thanks, the error was in the ExecuteNonQuery method, which is just a wrapper
around SqlCommand.ExecuteNonQuery... It's solved now, thanks to your tip
about checking ExecuteNonQuery

"Tor Bdshaug" <tor.badshaug@.nospam.comwrote in message
news:%23TqCCAw6GHA.4996@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

What is the ExecuteNonQuery method you try to call after all?
Normally, you will do a cmd.ExecuteNonQuery, rather than
ExecuteNonQuery(cmd).
Could it be that your ExecuteNonQuery(SqlCommand cmd) method in somewhat
fail to do a cmd.ExecuteNonQuery.
The fact that the output parameter does not have a value may suggest that
may be the case.
>
Tor Bdshaug
tor.badshaug(AT)bekk.no
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>Hey
>>
>asp.net 2.0
>>
>My code below crashes at the "return
>(int)cmd.Parameters["@.return"].Value;" line. In the debugging window I
>see that when this exception occur, the "return
>(int)cmd.Parameters["@.return"].Value;" has a NULL value...
>>
>public override int SendMessage(MessageDetails message)
>{
> using (SqlConnection cn = new SqlConnection(this.ConnectionString))
> {
> SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
> cmd.CommandType = CommandType.StoredProcedure;
> cmd.Parameters.Add("@.receiver", SqlDbType.NVarChar).Value =
>message.Sender;
> cmd.Parameters.Add("@.sender", SqlDbType.NVarChar).Value =
>message.Sender;
> cmd.Parameters.Add("@.title", SqlDbType.NVarChar).Value =
>message.Title;
> cmd.Parameters.Add("@.body", SqlDbType.NVarChar).Value =
>message.Body;
> cmd.Parameters.Add("@.return", SqlDbType.Int).Direction =
>ParameterDirection.Output;
> cn.Open();
> int ret = ExecuteNonQuery(cmd);
> return (int)cmd.Parameters["@.return"].Value;
> }
>}
>>
>This is the stored procdure called in the method:
>ALTER PROCEDURE dbo.AH_network_SendMessages
>@.sender nvarchar(256),
>@.receiver nvarchar(256),
>@.title nvarchar(100),
>@.body nvarchar(2000),
>@.return int OUTPUT
>AS
>BEGIN
>SET NOCOUNT ON;
>INSERT INTO AH_Messages (sender, receiver, title, body)
> VALUES (@.sender, @.receiver, @.title, @.body);
>>
>set @.return = 1;
>select 1;
>END
>>
>Please, what am I doing wrong here?
>>
>Jeff
>>


>
>


I am not sure why you are selecting 1 after setting the @.return. There is no
need unless you are doing something with it. Since you are ExecuteNonQuery,
this is a wasted cycle.

Next, why are you not testing "ret" in your code. If it is -1, the insert
failed for some reason. By testing that you could determine what your issue
is.

Also, why have you not wrapped the open and ExecuteNonQuery() in a try. Here
is a good pattern:

try
{
cn.Open();
int ret = ExecuteNonQuery(cmd);
}
finally
{
cn.Dispose();
}

Not sure what you are returning.

Next suggestion. Do not return until you test the parameter. If it is is
null, the cast to int will blow up (nice technical term ;->).

Be careful with calling thisgs return in a stored proc, as SQL Server
already returns a value (even if you do not declare it) called
@.RETURN_VALUE.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/
*************************************************
Think Outside the Box!
*************************************************
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hey
>
asp.net 2.0
>
My code below crashes at the "return
(int)cmd.Parameters["@.return"].Value;" line. In the debugging window I see
that when this exception occur, the "return
(int)cmd.Parameters["@.return"].Value;" has a NULL value...
>
public override int SendMessage(MessageDetails message)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@.receiver", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@.sender", SqlDbType.NVarChar).Value =
message.Sender;
cmd.Parameters.Add("@.title", SqlDbType.NVarChar).Value =
message.Title;
cmd.Parameters.Add("@.body", SqlDbType.NVarChar).Value =
message.Body;
cmd.Parameters.Add("@.return", SqlDbType.Int).Direction =
ParameterDirection.Output;
cn.Open();
int ret = ExecuteNonQuery(cmd);
return (int)cmd.Parameters["@.return"].Value;
}
}
>
This is the stored procdure called in the method:
ALTER PROCEDURE dbo.AH_network_SendMessages
@.sender nvarchar(256),
@.receiver nvarchar(256),
@.title nvarchar(100),
@.body nvarchar(2000),
@.return int OUTPUT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO AH_Messages (sender, receiver, title, body)
VALUES (@.sender, @.receiver, @.title, @.body);
>
set @.return = 1;
select 1;
END
>
Please, what am I doing wrong here?
>
Jeff
>


Hey

Thanks, yes selecting 1 after setting the @.return to 1 is bad programming. I
know it, I will later rewrite this stored procedure and then I will fix
this.. the procedure is also missing a commit/rollback... I guess auto
commit is enabled but I prefer using explicit transaction...

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamMwrote in
message news:ON3X9Jw6GHA.2288@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>I am not sure why you are selecting 1 after setting the @.return. There is
>no need unless you are doing something with it. Since you are
>ExecuteNonQuery, this is a wasted cycle.
>
Next, why are you not testing "ret" in your code. If it is -1, the insert
failed for some reason. By testing that you could determine what your
issue is.
>
Also, why have you not wrapped the open and ExecuteNonQuery() in a try.
Here is a good pattern:
>
try
{
cn.Open();
int ret = ExecuteNonQuery(cmd);
}
finally
{
cn.Dispose();
}
>
Not sure what you are returning.
>
Next suggestion. Do not return until you test the parameter. If it is is
null, the cast to int will blow up (nice technical term ;->).
>
Be careful with calling thisgs return in a stored proc, as SQL Server
already returns a value (even if you do not declare it) called
@.RETURN_VALUE.
>
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/
>
*************************************************
Think Outside the Box!
*************************************************
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:unl2osv6GHA.4580@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>Hey
>>
>asp.net 2.0
>>
>My code below crashes at the "return
>(int)cmd.Parameters["@.return"].Value;" line. In the debugging window I
>see that when this exception occur, the "return
>(int)cmd.Parameters["@.return"].Value;" has a NULL value...
>>
>public override int SendMessage(MessageDetails message)
>{
> using (SqlConnection cn = new SqlConnection(this.ConnectionString))
> {
> SqlCommand cmd = new SqlCommand("AH_network_SendMessages", cn);
> cmd.CommandType = CommandType.StoredProcedure;
> cmd.Parameters.Add("@.receiver", SqlDbType.NVarChar).Value =
>message.Sender;
> cmd.Parameters.Add("@.sender", SqlDbType.NVarChar).Value =
>message.Sender;
> cmd.Parameters.Add("@.title", SqlDbType.NVarChar).Value =
>message.Title;
> cmd.Parameters.Add("@.body", SqlDbType.NVarChar).Value =
>message.Body;
> cmd.Parameters.Add("@.return", SqlDbType.Int).Direction =
>ParameterDirection.Output;
> cn.Open();
> int ret = ExecuteNonQuery(cmd);
> return (int)cmd.Parameters["@.return"].Value;
> }
>}
>>
>This is the stored procdure called in the method:
>ALTER PROCEDURE dbo.AH_network_SendMessages
>@.sender nvarchar(256),
>@.receiver nvarchar(256),
>@.title nvarchar(100),
>@.body nvarchar(2000),
>@.return int OUTPUT
>AS
>BEGIN
>SET NOCOUNT ON;
>INSERT INTO AH_Messages (sender, receiver, title, body)
> VALUES (@.sender, @.receiver, @.title, @.body);
>>
>set @.return = 1;
>select 1;
>END
>>
>Please, what am I doing wrong here?
>>
>Jeff
>>


>
>

newbie: problem with menuitems

hey

asp.net 2.0

My webportal consist of 2 menus (a header menu which goes horizontally
across the top of the page. And a sidebar menu to the left. The menuitmes
shown in the sidebar menu is dependent on what menuitem is selected in the
main menu.)

This is my sitemap (or a part of it)
<siteMapNode url="~/Network.aspx" title="Network" description="" >
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="" title="Invite" description="" />
</siteMapNode>
<siteMapNode url="~/Member.aspx" title="Member" description="" >
<siteMapNode url="" title="ItemA" description="" />
<siteMapNode url="" title="ItemB" description="" />
<siteMapNode url="" title="ItemC" description="" />
<siteMapNode url="" title="ItemD" description="" />
<siteMapNode url="" title="ItemE" description="" />
<siteMapNode url="" title="ItemF" description="" />
<siteMapNode url="" title="ItemG" description="" />
</siteMapNode
My problem now is that the sub menu items of "Member" isn't displayed when
Member.aspx is the active page...

This scenario involves 3 web pages. "search.aspx", "result.aspx" and
"Member.aspx". It works like this: The user opens the search.aspx file to do
a search (He enter some values in a textbox and clicks on a button). The
result.aspx file is shown, displaying the result of the search... Now I can
click on one of the rows in the repeater control of "result.aspx" to bring
up Member.aspx (displaying detailed info about the member)

I use Server.Transfer to go from search.aspx -result.aspx -Member.aspx

The code in the search.aspx file calling the result.page:
Server.Transfer("~/Result.aspx?name=" + txtFullname.Text);
After the transfer to result.aspx my browser shows still the same URL as it
had on the search.aspx page (http://localhost:2773/Search.aspx)

The code in the result.aspx file calling Member.aspx:
protected void OnClick(Object o, ImageMapEventArgs e)
{
string id = e.PostBackValue; //will use this variable later, when the
menu works
Server.Transfer("~/Member.aspx");
}
After the transfer to Member.aspx my browser shows this URL
:http://localhost:2773/Result.aspx?name=l

It looks like the URL for member.aspx show the URL for result.aspx...

BTW I enter entered "Member.aspx" directly in my browser URL and then it
displayed to the correct sub menu items in the sidebar menu..

So I guess my problem is related to the URL problem mentioned above. Any
suggestions to solve my problem with submenu items/URL mentioned above are
greatly appreciated!

JeffCASE SOLVED

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:eZDncSZsGHA.4324@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
My webportal consist of 2 menus (a header menu which goes horizontally
across the top of the page. And a sidebar menu to the left. The menuitmes
shown in the sidebar menu is dependent on what menuitem is selected in the
main menu.)
>
>
This is my sitemap (or a part of it)
<siteMapNode url="~/Network.aspx" title="Network" description="" >
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="" title="Invite" description="" />
</siteMapNode>
<siteMapNode url="~/Member.aspx" title="Member" description="" >
<siteMapNode url="" title="ItemA" description="" />
<siteMapNode url="" title="ItemB" description="" />
<siteMapNode url="" title="ItemC" description="" />
<siteMapNode url="" title="ItemD" description="" />
<siteMapNode url="" title="ItemE" description="" />
<siteMapNode url="" title="ItemF" description="" />
<siteMapNode url="" title="ItemG" description="" />
</siteMapNode>
>
My problem now is that the sub menu items of "Member" isn't displayed when
Member.aspx is the active page...
>
This scenario involves 3 web pages. "search.aspx", "result.aspx" and
"Member.aspx". It works like this: The user opens the search.aspx file to
do a search (He enter some values in a textbox and clicks on a button).
The result.aspx file is shown, displaying the result of the search... Now
I can click on one of the rows in the repeater control of "result.aspx" to
bring up Member.aspx (displaying detailed info about the member)
>
I use Server.Transfer to go from search.aspx -result.aspx -Member.aspx
>
The code in the search.aspx file calling the result.page:
Server.Transfer("~/Result.aspx?name=" + txtFullname.Text);
After the transfer to result.aspx my browser shows still the same URL as
it had on the search.aspx page (http://localhost:2773/Search.aspx)
>
The code in the result.aspx file calling Member.aspx:
protected void OnClick(Object o, ImageMapEventArgs e)
{
string id = e.PostBackValue; //will use this variable later, when the
menu works
Server.Transfer("~/Member.aspx");
}
After the transfer to Member.aspx my browser shows this URL
:http://localhost:2773/Result.aspx?name=l
>
It looks like the URL for member.aspx show the URL for result.aspx...
>
BTW I enter entered "Member.aspx" directly in my browser URL and then it
displayed to the correct sub menu items in the sidebar menu..
>
So I guess my problem is related to the URL problem mentioned above. Any
suggestions to solve my problem with submenu items/URL mentioned above are
greatly appreciated!
>
Jeff
>

newbie: problems with SiteMapProviders

hey

asp.net 2.0

My problem is that no matter what SiteMapProvider I specify in the code, it
always uses defaultProvider SiteMapProvider. In other words if I make these
changes to the SiteMapDataSource1:
<siteMap defaultProvider="Anonymous">
The menu which is based on this SiteMapProvider get menu items from the
Anoymous SiteMapProvider... But SiteMapDataSource1.SiteMapProvider is set to
"LoggedIn"

<siteMap defaultProvider="LoggedIn">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>

<LoggedInTemplate>
<asp:Menu ID="mnuHeader" runat="server" BackColor="#F7F6F3"
DataSourceID="SiteMapDataSource1"
DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em"
ForeColor="#7C6F57"
MaximumDynamicDisplayLevels="0" Orientation="Horizontal"
StaticDisplayLevels="2"
StaticSubMenuIndent="10px" Style="z-index: 100; left: 0px; position:
absolute;
top: 0px" OnMenuItemClick="mnuHeader_MenuItemClick" Width="900px">
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
/>
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuStyle BackColor="#F7F6F3" />
<StaticSelectedStyle BackColor="#5D7B9D" />
<DynamicSelectedStyle BackColor="#5D7B9D" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
/>
<StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DataBindings>
<asp:MenuItemBinding DataMember="SiteMapNode"
NavigateUrlField="Url" TextField="Title" />
</DataBindings>
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
SiteMapProvider="LoggedIn" />
</LoggedInTemplate>

I even tryed this example:
http://msdn2.microsoft.com/en-us/li...426(d=ide).aspx :
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>

But then I get this error:
Parser Error Message: The provider 'XmlSiteMapProvider' specified for the
defaultProvider does not exist in the providers collection.

If the SiteMapDataSource1.SiteMapProvider is set to "LoggedIn", then I want
it to use the "LoggedIn" SiteMapProvider, not use what is specified as the
defaultProvider.

Any suggestions on how to solve this are very welcome

Jeff"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:OQOfZqxrGHA.4252@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
My problem is that no matter what SiteMapProvider I specify in the code,
it always uses defaultProvider SiteMapProvider. In other words if I make
these changes to the SiteMapDataSource1:
<siteMap defaultProvider="Anonymous">
The menu which is based on this SiteMapProvider get menu items from the
Anoymous SiteMapProvider... But SiteMapDataSource1.SiteMapProvider is set
to "LoggedIn"
>
<siteMap defaultProvider="LoggedIn">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>
>
<LoggedInTemplate>
<asp:Menu ID="mnuHeader" runat="server" BackColor="#F7F6F3"
DataSourceID="SiteMapDataSource1"
DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em"
ForeColor="#7C6F57"
MaximumDynamicDisplayLevels="0" Orientation="Horizontal"
StaticDisplayLevels="2"
StaticSubMenuIndent="10px" Style="z-index: 100; left: 0px;
position: absolute;
top: 0px" OnMenuItemClick="mnuHeader_MenuItemClick" Width="900px">
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
/>
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuStyle BackColor="#F7F6F3" />
<StaticSelectedStyle BackColor="#5D7B9D" />
<DynamicSelectedStyle BackColor="#5D7B9D" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
/>
<StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DataBindings>
<asp:MenuItemBinding DataMember="SiteMapNode"
NavigateUrlField="Url" TextField="Title" />
</DataBindings>
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
SiteMapProvider="LoggedIn" />
</LoggedInTemplate>
>
I even tryed this example:
http://msdn2.microsoft.com/en-us/li...426(d=ide).aspx :
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>
>
But then I get this error:
Parser Error Message: The provider 'XmlSiteMapProvider' specified for the
defaultProvider does not exist in the providers collection.
>
If the SiteMapDataSource1.SiteMapProvider is set to "LoggedIn", then I
want it to use the "LoggedIn" SiteMapProvider, not use what is specified
as the defaultProvider.
>
Any suggestions on how to solve this are very welcome
>
Jeff
>
>
>
>


Would you care to share the solution, Jeff, so others can benefit ?

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:e0Dsaj3rGHA.356@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:OQOfZqxrGHA.4252@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>hey
>>
>asp.net 2.0
>>
>My problem is that no matter what SiteMapProvider I specify in the code, it always uses
>defaultProvider SiteMapProvider. In other words if I make these changes to the
>SiteMapDataSource1:
><siteMap defaultProvider="Anonymous">
>The menu which is based on this SiteMapProvider get menu items from the Anoymous
>SiteMapProvider... But SiteMapDataSource1.SiteMapProvider is set to "LoggedIn"
>>
><siteMap defaultProvider="LoggedIn">
> <providers>
> <add name="LoggedIn" type="System.Web.XmlSiteMapProvider" siteMapFile="LoggedIn.sitemap"/>
> <add name="Anonymous" type="System.Web.XmlSiteMapProvider"
>siteMapFile="Anonymous.sitemap"/>
> </providers>
></siteMap>
>>
><LoggedInTemplate>
> <asp:Menu ID="mnuHeader" runat="server" BackColor="#F7F6F3" DataSourceID="SiteMapDataSource1"
> DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#7C6F57"
> MaximumDynamicDisplayLevels="0" Orientation="Horizontal" StaticDisplayLevels="2"
> StaticSubMenuIndent="10px" Style="z-index: 100; left: 0px; position: absolute;
> top: 0px" OnMenuItemClick="mnuHeader_MenuItemClick" Width="900px">
> <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
> <DynamicMenuStyle BackColor="#F7F6F3" />
> <StaticSelectedStyle BackColor="#5D7B9D" />
> <DynamicSelectedStyle BackColor="#5D7B9D" />
> <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
> <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
> <DataBindings>
> <asp:MenuItemBinding DataMember="SiteMapNode" NavigateUrlField="Url" TextField="Title"
>/>
> </DataBindings>
> </asp:Menu>
> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" SiteMapProvider="LoggedIn" />
></LoggedInTemplate>
>>
>I even tryed this example: http://msdn2.microsoft.com/en-us/li...426(d=ide).aspx :
><siteMap defaultProvider="XmlSiteMapProvider">
> <providers>
> <add name="LoggedIn" type="System.Web.XmlSiteMapProvider" siteMapFile="LoggedIn.sitemap"/>
> <add name="Anonymous" type="System.Web.XmlSiteMapProvider"
>siteMapFile="Anonymous.sitemap"/>
> </providers>
></siteMap>
>>
>But then I get this error:
>Parser Error Message: The provider 'XmlSiteMapProvider' specified for the defaultProvider does
>not exist in the providers collection.
>>
>If the SiteMapDataSource1.SiteMapProvider is set to "LoggedIn", then I want it to use the
>"LoggedIn" SiteMapProvider, not use what is specified as the defaultProvider.
>>
>Any suggestions on how to solve this are very welcome
>>
>Jeff
>>
>>
>>
>>


>
>


It was my own mistake, doing modification to the wrong master page. I have 3
master pages in my project: Frontpage.master, MasterPage.master and
ContentMaster.master. MasterPage and ContentMaster are very similar but
MasterPage isn't used in the project. So here I accidently did modifications
to MasterPage and wondered why I didn't see the changes when I tested the
web portal.... But after a while I discovered that it was the ContentMaster
I used...

I also have to add that I made some modifications to the SiteMapProvider
settings in web.config:
<siteMap defaultProvider="AspNetXmlSiteMapProvider">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>

Previously I used "LoggedIn" or "Anonymous" as defaultProvider. Then I read
that defaultProvider had to be something else if it was going to work. So I
tryed "AspLoggedIn", because I've seen in a example where someone used
"AspNetXmlSiteMapProvider".. But that didn't work... But then I tryed using
"AspNetXmlSiteMapProvider" and it works now

"Juan T. Llibre" <nomailreplies@.nowhere.comwrote in message
news:%23sq8g%23$rGHA.2416@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Would you care to share the solution, Jeff, so others can benefit ?
>
>
>
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:e0Dsaj3rGHA.356@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>>
>"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
>news:OQOfZqxrGHA.4252@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>>hey
>>>
>>asp.net 2.0
>>>
>>My problem is that no matter what SiteMapProvider I specify in the code,
>>it always uses defaultProvider SiteMapProvider. In other words if I make
>>these changes to the SiteMapDataSource1:
>><siteMap defaultProvider="Anonymous">
>>The menu which is based on this SiteMapProvider get menu items from the
>>Anoymous SiteMapProvider... But SiteMapDataSource1.SiteMapProvider is
>>set to "LoggedIn"
>>>
>><siteMap defaultProvider="LoggedIn">
>> <providers>
>> <add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
>>siteMapFile="LoggedIn.sitemap"/>
>> <add name="Anonymous" type="System.Web.XmlSiteMapProvider"
>>siteMapFile="Anonymous.sitemap"/>
>> </providers>
>></siteMap>
>>>
>><LoggedInTemplate>
>> <asp:Menu ID="mnuHeader" runat="server" BackColor="#F7F6F3"
>>DataSourceID="SiteMapDataSource1"
>> DynamicHorizontalOffset="2" Font-Names="Verdana"
>>Font-Size="0.8em" ForeColor="#7C6F57"
>> MaximumDynamicDisplayLevels="0" Orientation="Horizontal"
>>StaticDisplayLevels="2"
>> StaticSubMenuIndent="10px" Style="z-index: 100; left: 0px;
>>position: absolute;
>> top: 0px" OnMenuItemClick="mnuHeader_MenuItemClick"
>>Width="900px">
>> <StaticMenuItemStyle HorizontalPadding="5px"
>>VerticalPadding="2px" />
>> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
>> <DynamicMenuStyle BackColor="#F7F6F3" />
>> <StaticSelectedStyle BackColor="#5D7B9D" />
>> <DynamicSelectedStyle BackColor="#5D7B9D" />
>> <DynamicMenuItemStyle HorizontalPadding="5px"
>>VerticalPadding="2px" />
>> <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
>> <DataBindings>
>> <asp:MenuItemBinding DataMember="SiteMapNode"
>>NavigateUrlField="Url" TextField="Title" />
>> </DataBindings>
>> </asp:Menu>
>> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
>>SiteMapProvider="LoggedIn" />
>></LoggedInTemplate>
>>>
>>I even tryed this example:
>>http://msdn2.microsoft.com/en-us/li...426(d=ide).aspx :
>><siteMap defaultProvider="XmlSiteMapProvider">
>> <providers>
>> <add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
>>siteMapFile="LoggedIn.sitemap"/>
>> <add name="Anonymous" type="System.Web.XmlSiteMapProvider"
>>siteMapFile="Anonymous.sitemap"/>
>> </providers>
>></siteMap>
>>>
>>But then I get this error:
>>Parser Error Message: The provider 'XmlSiteMapProvider' specified for
>>the defaultProvider does not exist in the providers collection.
>>>
>>If the SiteMapDataSource1.SiteMapProvider is set to "LoggedIn", then I
>>want it to use the "LoggedIn" SiteMapProvider, not use what is specified
>>as the defaultProvider.
>>>
>>Any suggestions on how to solve this are very welcome
>>>
>>Jeff
>>>
>>>
>>>
>>>


>>
>>


>
>